diff --git a/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutSetTest.php b/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutSetTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e1982de648deef5c1d139983ab2fa38c177ce398 --- /dev/null +++ b/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutSetTest.php @@ -0,0 +1,41 @@ +<?php + +namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests D7 ShortcutSet source plugin. + * + * @covers Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSet + * + * @group shortcut + */ +class ShortcutSetTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['shortcut', 'migrate_drupal']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['source_data']['shortcut_set'] = [ + [ + 'set_name' => 'shortcut-set-2', + 'title' => 'Alternative shortcut set', + ], + ]; + + // The expected results are identical to the source data. + $tests[0]['expected_data'] = $tests[0]['source_data']['shortcut_set']; + + return $tests; + } + +} diff --git a/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutSetUsersTest.php b/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutSetUsersTest.php new file mode 100644 index 0000000000000000000000000000000000000000..035aec31c909e05d9c83328f27589444aa8372da --- /dev/null +++ b/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutSetUsersTest.php @@ -0,0 +1,41 @@ +<?php + +namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests D7 ShortcutSetUsers source plugin. + * + * @covers Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSetUsers + * + * @group shortcut + */ +class ShortcutSetUsersTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['shortcut', 'migrate_drupal']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['source_data']['shortcut_set_users'] = [ + [ + 'uid' => '2', + 'set_name' => 'shortcut-set-2', + ], + ]; + + // The expected results are identical to the source data. + $tests[0]['expected_data'] = $tests[0]['source_data']['shortcut_set_users']; + + return $tests; + } + +} diff --git a/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutTest.php b/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9f8fd3ae66d957895fa21239c20484b3c8c1dc4c --- /dev/null +++ b/core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutTest.php @@ -0,0 +1,72 @@ +<?php + +namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests D7 Shortcut source plugin. + * + * @covers Drupal\shortcut\Plugin\migrate\source\d7\Shortcut + * + * @group shortcut + */ +class ShortcutTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['shortcut', 'migrate_drupal']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['source_data']['menu_links'] = [ + [ + 'menu_name' => 'shortcut-set-2', + 'mlid' => '473', + 'plid' => '0', + 'link_path' => 'admin/people', + 'router_path' => 'admin/people', + 'link_title' => 'People', + 'options' => 'a:0:{}', + 'module' => 'menu', + 'hidden' => '0', + 'external' => '0', + 'has_children' => '0', + 'expanded' => '0', + 'weight' => '-50', + 'depth' => '1', + 'customized' => '0', + 'p1' => '473', + 'p2' => '0', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + ] + ]; + + // The expected results. + $tests[0]['expected_data'] = [ + [ + 'mlid' => '473', + 'menu_name' => 'shortcut-set-2', + 'link_path' => 'admin/people', + 'link_title' => 'People', + 'weight' => '-50', + ], + ]; + + return $tests; + } + +} diff --git a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetTest.php b/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetTest.php deleted file mode 100644 index f2f221f093bd035716733a218bb870e959df7825..0000000000000000000000000000000000000000 --- a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7; - -use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; - -/** - * Tests D7 ShortcutSet source plugin. - * - * @group shortcut - */ -class ShortcutSetTest extends MigrateSqlSourceTestCase { - - const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSet'; - - protected $migrationConfiguration = [ - 'id' => 'test', - 'source' => [ - 'plugin' => 'd7_shortcut_set', - ], - ]; - - protected $expectedResults = [ - [ - 'set_name' => 'shortcut-set-2', - 'title' => 'Alternative shortcut set', - ], - ]; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['shortcut_set'] = $this->expectedResults; - parent::setUp(); - } - -} diff --git a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetUsersTest.php b/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetUsersTest.php deleted file mode 100644 index 5681f6dfc582a03b09dc8eaec12469e52ac61d70..0000000000000000000000000000000000000000 --- a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetUsersTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7; - -use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; - -/** - * Tests D7 ShortcutSetUsers source plugin. - * - * @group shortcut - */ -class ShortcutSetUsersTest extends MigrateSqlSourceTestCase { - - const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSetUsers'; - - protected $migrationConfiguration = [ - 'id' => 'test', - 'source' => [ - 'plugin' => 'd7_shortcut_set_users', - ], - ]; - - protected $expectedResults = [ - [ - 'uid' => '2', - 'set_name' => 'shortcut-set-2', - ], - ]; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['shortcut_set_users'] = $this->expectedResults; - parent::setUp(); - } - -} diff --git a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutTest.php b/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutTest.php deleted file mode 100644 index 9fde228bc5b5348ff04d78316cc211cfe08f1720..0000000000000000000000000000000000000000 --- a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7; - -use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; - -/** - * Tests D7 Shortcut source plugin. - * - * @group shortcut - */ -class ShortcutTest extends MigrateSqlSourceTestCase { - - const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\Shortcut'; - - protected $migrationConfiguration = [ - 'id' => 'test', - 'source' => [ - 'plugin' => 'd7_shortcut', - ], - ]; - - protected $expectedResults = [ - [ - 'mlid' => '473', - 'menu_name' => 'shortcut-set-2', - 'link_path' => 'admin/people', - 'link_title' => 'People', - 'weight' => '-50', - ], - ]; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['menu_links'][] = [ - 'menu_name' => 'shortcut-set-2', - 'mlid' => '473', - 'plid' => '0', - 'link_path' => 'admin/people', - 'router_path' => 'admin/people', - 'link_title' => 'People', - 'options' => 'a:0:{}', - 'module' => 'menu', - 'hidden' => '0', - 'external' => '0', - 'has_children' => '0', - 'expanded' => '0', - 'weight' => '-50', - 'depth' => '1', - 'customized' => '0', - 'p1' => '473', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - ]; - - parent::setUp(); - } - -}