diff --git a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowSourceWithHighwaterTest.php b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowSourceWithHighwaterTest.php new file mode 100644 index 0000000..d14e0f5 --- /dev/null +++ b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowSourceWithHighwaterTest.php @@ -0,0 +1,58 @@ + 'foo', 'value' => 'i:1;'], + ['name' => 'bar', 'value' => 'b:0;'] + ]; + + // The expected results. + $tests[0]['expected_data'] = [ + [ + 'name' => 'bar', + 'value' => FALSE, + ], + [ + 'name' => 'foo', + 'value' => 1, + ], + ]; + + // The expected count. + $tests[0]['expected_count'] = NULL; + + // The source plugin configuration. + $tests[0]['configuration']['variables'] = [ + 'foo', + 'bar', + ]; + $tests[0]['configuration']['high_water_property']['name'] = 'name'; + + return $tests; + } + +} diff --git a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowTest.php b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowTest.php index fd84781..932af99 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source; +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + /** * Tests the variable multirow source plugin. * @@ -9,7 +11,7 @@ * * @group migrate_drupal */ -class VariableMultiRowTest extends VariableTest { +class VariableMultiRowTest extends MigrateSqlSourceTestBase { /** * {@inheritdoc} @@ -20,21 +22,35 @@ class VariableMultiRowTest extends VariableTest { * {@inheritdoc} */ public function providerSource() { - // Use the same test data as parent. - $tests = parent::providerSource(); + $tests = []; + + // The source data. + $tests[0]['source_data']['variable'] = [ + ['name' => 'foo', 'value' => 'i:1;'], + ['name' => 'bar', 'value' => 'b:0;'], + ]; // The expected results. $tests[0]['expected_data'] = [ [ 'name' => 'foo', - 'value' => 1 + 'value' => 1, ], [ 'name' => 'bar', - 'value' => FALSE + 'value' => FALSE, ], ]; + // The expected count. + $tests[0]['expected_count'] = NULL; + + // The source plugin configuration. + $tests[0]['configuration']['variables'] = [ + 'foo', + 'bar', + ]; + return $tests; } diff --git a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableTest.php b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableTest.php index cb9f932..b68c4b4 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableTest.php @@ -27,7 +27,7 @@ public function providerSource() { // The source data. $tests[0]['source_data']['variable'] = [ ['name' => 'foo', 'value' => 'i:1;'], - ['name' => 'bar', 'value' => 'b:0;'] + ['name' => 'bar', 'value' => 'b:0;'], ]; // The expected results. @@ -35,7 +35,7 @@ public function providerSource() { [ 'id' => 'foo', 'foo' => 1, - 'bar' => FALSE + 'bar' => FALSE, ], ]; @@ -45,7 +45,7 @@ public function providerSource() { // The source plugin configuration. $tests[0]['configuration']['variables'] = [ 'foo', - 'bar' + 'bar', ]; return $tests;