Commit 9c63eae0 authored by heddn's avatar heddn Committed by heddn

Issue #3019796 by heddn, mikelutz: Run D.O. tests with deprecation notices enabled

parent b3a88435
# Learn to make one for your own drupal.org project:
# https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing
build:
assessment:
validate_codebase:
phplint:
container_composer:
csslint:
halt-on-fail: true
eslint:
halt-on-fail: true
phpcs:
# phpcs will use core's specified version of Coder.
sniff-all-files: true
halt-on-fail: true
testing:
# run_tests task is executed several times in order of performance speeds.
# halt-on-fail can be set on the run_tests tasks in order to fail fast.
# suppress-deprecations is false in order to be alerted to usages of
# deprecated code.
run_tests.standard:
types: 'Simpletest,PHPUnit-Unit,PHPUnit-Kernel,PHPUnit-Functional'
testgroups: '--all'
suppress-deprecations: false
run_tests.js:
types: 'PHPUnit-FunctionalJavascript'
testgroups: '--all'
suppress-deprecations: false
nightwatchjs: { }
......@@ -13,7 +13,7 @@ function migrate_json_example_install() {
$directory = file_default_scheme() . '://migrate_json_example';
file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
// Copy the example file to example directory
// Copy the example file to example directory.
$module_path = drupal_get_path('module', 'migrate_json_example');
$file_source = $module_path . '/artifacts/products.json';
file_unmanaged_copy($file_source, $directory . '/products.json', FILE_EXISTS_REPLACE);
......
......@@ -20,7 +20,21 @@ use Drupal\Core\Entity\EntityTypeInterface;
* "label" = "label",
* "weight" = "weight",
* "status" = "status"
* }
* },
* config_export = {
* "id",
* "class",
* "field_plugin_method",
* "cck_plugin_method",
* "migration_tags",
* "migration_group",
* "status",
* "label",
* "source",
* "process",
* "destination",
* "migration_dependencies",
* },
* )
*/
class Migration extends ConfigEntityBase implements MigrationInterface {
......
......@@ -19,7 +19,15 @@ use Drupal\Core\Config\Entity\ConfigEntityBase;
* entity_keys = {
* "id" = "id",
* "label" = "label"
* }
* },
* config_export = {
* "id",
* "label",
* "description",
* "source_type",
* "module",
* "shared_configuration",
* },
* )
*/
class MigrationGroup extends ConfigEntityBase implements MigrationGroupInterface {
......
langcode: en
status: true
dependencies: { }
id: fruit_terms
label: Fruit Terms
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: { }
migration_group: default
source:
plugin: embedded_data
data_rows:
-
name: Apple
-
name: Banana
-
name: Orange
ids:
name:
type: string
constants:
vocabulary: fruit
process:
name: name
vid: constants/vocabulary
destination:
plugin: entity:taxonomy_term
migration_dependencies:
required: { }
optional: { }
langcode: en
status: true
dependencies: { }
id: default
label: Default
description: ''
source_type: ''
module: null
shared_configuration: null
type: module
name: Migrate Plus Test
description: 'Test module to test Migrate Plus.'
package: Testing
core: 8.x
dependencies:
- drupal:migrate (>=8.3)
- migrate_plus:migrate_plus
......@@ -3,17 +3,25 @@
namespace Drupal\Tests\migrate_plus\Kernel;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\KernelTests\KernelTestBase;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_plus\Entity\Migration;
use Drupal\Tests\migrate\Kernel\MigrateTestBase;
/**
* Test migration config entity discovery.
*
* @group migrate_plus
*/
class MigrationConfigEntityTest extends KernelTestBase {
class MigrationConfigEntityTest extends MigrateTestBase {
public static $modules = ['migrate', 'migrate_plus'];
public static $modules = [
'migrate',
'migrate_plus',
'migrate_plus_test',
'taxonomy',
'text',
'system',
];
/**
* The plugin manager.
......@@ -28,6 +36,9 @@ class MigrationConfigEntityTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
$this->pluginManager = \Drupal::service('plugin.manager.migration');
$this->installConfig('migrate_plus');
$this->installEntitySchema('taxonomy_term');
$this->installSchema('system', ['key_value', 'key_value_expire']);
}
/**
......@@ -96,4 +107,17 @@ class MigrationConfigEntityTest extends KernelTestBase {
$this->pluginManager->getDefinition('test_inactive');
}
/**
* Tests migration from configuration.
*/
public function testImport() {
$this->installConfig('migrate_plus_test');
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$migration = $this->pluginManager->createInstance('fruit_terms');
$id_map = $migration->getIdMap();
$executable = new MigrateExecutable($migration, $this);
$executable->import();
$this->assertSame(3, $id_map->importedCount());
}
}
......@@ -169,8 +169,9 @@ class HttpTest extends MigrateTestCase {
}
}
/**
* @class Test class to mock an HTTP request.
* Test class to mock an HTTP request.
*/
class TestHttp extends Http {
......@@ -190,7 +191,7 @@ class TestHttp extends Http {
* @param \PHPUnit_Framework_MockObject_MockObject $authenticator
* Mocked authenticator plugin.
*/
public function mockHttpClient($responses, $authenticator) {
public function mockHttpClient(array $responses, \PHPUnit_Framework_MockObject_MockObject $authenticator = NULL) {
// Set mocked authentication plugin to be used for the request auth plugin.
$this->authenticator = $authenticator;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment