From 85042d0103bff124015d01b69659560ead8905f4 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Thu, 17 Sep 2015 15:56:44 +0100 Subject: [PATCH] Revert "Issue #2500513 by svendecabooter, phenaproxima: Upgrade path for Shortcut 7.x" This reverts commit 33608908fa6c5daca5765ae0da87970ed5c70ce8. --- .../src/Tests/Table/d7/MenuLinks.php | 54 +--------- .../src/Tests/Table/d7/ShortcutSet.php | 5 +- .../src/Tests/Table/d7/ShortcutSetUsers.php | 7 +- .../migration_templates/d7_shortcut.yml | 26 ----- .../migration_templates/d7_shortcut_set.yml | 20 ---- .../d7_shortcut_set_users.yml | 25 ----- .../migrate/destination/EntityShortcutSet.php | 31 ------ .../migrate/destination/ShortcutSetUsers.php | 101 ------------------ .../src/Plugin/migrate/source/d7/Shortcut.php | 52 --------- .../Plugin/migrate/source/d7/ShortcutSet.php | 46 -------- .../migrate/source/d7/ShortcutSetUsers.php | 52 --------- .../Migrate/d7/MigrateShortcutSetTest.php | 77 ------------- .../d7/MigrateShortcutSetUsersTest.php | 61 ----------- .../Tests/Migrate/d7/MigrateShortcutTest.php | 79 -------------- .../migrate/source/d7/ShortcutSetTest.php | 43 -------- .../source/d7/ShortcutSetUsersTest.php | 43 -------- .../Plugin/migrate/source/d7/ShortcutTest.php | 73 ------------- 17 files changed, 4 insertions(+), 791 deletions(-) delete mode 100644 core/modules/shortcut/migration_templates/d7_shortcut.yml delete mode 100644 core/modules/shortcut/migration_templates/d7_shortcut_set.yml delete mode 100644 core/modules/shortcut/migration_templates/d7_shortcut_set_users.yml delete mode 100644 core/modules/shortcut/src/Plugin/migrate/destination/EntityShortcutSet.php delete mode 100644 core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php delete mode 100644 core/modules/shortcut/src/Plugin/migrate/source/d7/Shortcut.php delete mode 100644 core/modules/shortcut/src/Plugin/migrate/source/d7/ShortcutSet.php delete mode 100644 core/modules/shortcut/src/Plugin/migrate/source/d7/ShortcutSetUsers.php delete mode 100644 core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php delete mode 100644 core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetUsersTest.php delete mode 100644 core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutTest.php delete mode 100644 core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetTest.php delete mode 100644 core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetUsersTest.php delete mode 100644 core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutTest.php diff --git a/core/modules/migrate_drupal/src/Tests/Table/d7/MenuLinks.php b/core/modules/migrate_drupal/src/Tests/Table/d7/MenuLinks.php index 6b7a90e14376..0a4c29fc21d0 100644 --- a/core/modules/migrate_drupal/src/Tests/Table/d7/MenuLinks.php +++ b/core/modules/migrate_drupal/src/Tests/Table/d7/MenuLinks.php @@ -9964,60 +9964,8 @@ public function load() { 'p8' => '0', 'p9' => '0', 'updated' => '0', - ))->values(array( - 'menu_name' => 'shortcut-set-2', - 'mlid' => '472', - 'plid' => '0', - 'link_path' => 'admin/help', - 'router_path' => 'admin/help', - 'link_title' => 'Help', - 'options' => 'a:0:{}', - 'module' => 'menu', - 'hidden' => '0', - 'external' => '0', - 'has_children' => '0', - 'expanded' => '0', - 'weight' => '-49', - 'depth' => '1', - 'customized' => '0', - 'p1' => '472', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - ))->values(array( - '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', ))->execute(); } } -#f486477d40296da58f59a61204fa5370 +#8e0b0e21959e36a659b7ac2c4206fecd diff --git a/core/modules/migrate_drupal/src/Tests/Table/d7/ShortcutSet.php b/core/modules/migrate_drupal/src/Tests/Table/d7/ShortcutSet.php index f7f95b7e98c1..0324a14153ee 100644 --- a/core/modules/migrate_drupal/src/Tests/Table/d7/ShortcutSet.php +++ b/core/modules/migrate_drupal/src/Tests/Table/d7/ShortcutSet.php @@ -47,11 +47,8 @@ public function load() { ->values(array( 'set_name' => 'shortcut-set-1', 'title' => 'Default', - ))->values(array( - 'set_name' => 'shortcut-set-2', - 'title' => 'Alternative shortcut set', ))->execute(); } } -#65b4e1b8c85fc2c4232ce4bdb50a15ab +#b3fff732e065eff0eff212928ce45a0c diff --git a/core/modules/migrate_drupal/src/Tests/Table/d7/ShortcutSetUsers.php b/core/modules/migrate_drupal/src/Tests/Table/d7/ShortcutSetUsers.php index 7818c372d52b..6eff21eb66dd 100644 --- a/core/modules/migrate_drupal/src/Tests/Table/d7/ShortcutSetUsers.php +++ b/core/modules/migrate_drupal/src/Tests/Table/d7/ShortcutSetUsers.php @@ -45,11 +45,8 @@ public function load() { 'uid', 'set_name', )) - ->values(array( - 'uid' => '2', - 'set_name' => 'shortcut-set-2', - ))->execute(); + ->execute(); } } -#ee87e7f17ab09f7cdf72e64b5a66aca2 +#56b71631616c8eae6cc71b0ae443426a diff --git a/core/modules/shortcut/migration_templates/d7_shortcut.yml b/core/modules/shortcut/migration_templates/d7_shortcut.yml deleted file mode 100644 index da3d894940ff..000000000000 --- a/core/modules/shortcut/migration_templates/d7_shortcut.yml +++ /dev/null @@ -1,26 +0,0 @@ -id: d7_shortcut -label: Shortcut links -migration_tags: - - Drupal 7 -source: - plugin: d7_shortcut - constants: - uri_scheme: 'internal:/' -process: - shortcut_set: - plugin: migration - migration: d7_shortcut_set - source: menu_name - title: link_title - weight: weight - link: - plugin: concat - source: - - 'constants/uri_scheme' - - link_path -destination: - plugin: entity:shortcut -migration_dependencies: - required: - - d7_shortcut_set - - d7_menu_links diff --git a/core/modules/shortcut/migration_templates/d7_shortcut_set.yml b/core/modules/shortcut/migration_templates/d7_shortcut_set.yml deleted file mode 100644 index 784178e86269..000000000000 --- a/core/modules/shortcut/migration_templates/d7_shortcut_set.yml +++ /dev/null @@ -1,20 +0,0 @@ -id: d7_shortcut_set -label: Shortcut sets -migration_tags: - - Drupal 7 -source: - plugin: d7_shortcut_set -process: - id: - - - plugin: static_map - bypass: true - source: set_name - map: - shortcut-set-1: default - - - plugin: machine_name - field: id - label: title -destination: - plugin: entity:shortcut_set diff --git a/core/modules/shortcut/migration_templates/d7_shortcut_set_users.yml b/core/modules/shortcut/migration_templates/d7_shortcut_set_users.yml deleted file mode 100644 index a93c4bbab0ca..000000000000 --- a/core/modules/shortcut/migration_templates/d7_shortcut_set_users.yml +++ /dev/null @@ -1,25 +0,0 @@ -id: d7_shortcut_set_users -label: Shortcut set user mapping -migration_tags: - - Drupal 7 -source: - plugin: d7_shortcut_set_users -process: - uid: - - - plugin: migration - migration: d7_user - source: uid - - - plugin: skip_on_empty - method: row - set_name: - plugin: migration - migration: d7_shortcut_set - source: set_name -destination: - plugin: shortcut_set_users -migration_dependencies: - required: - - d7_shortcut_set - - d7_user diff --git a/core/modules/shortcut/src/Plugin/migrate/destination/EntityShortcutSet.php b/core/modules/shortcut/src/Plugin/migrate/destination/EntityShortcutSet.php deleted file mode 100644 index a63cf6fcca4b..000000000000 --- a/core/modules/shortcut/src/Plugin/migrate/destination/EntityShortcutSet.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\shortcut\Plugin\migrate\destination\EntityShortcutSet. - */ - -namespace Drupal\shortcut\Plugin\migrate\destination; - -use Drupal\migrate\Row; -use Drupal\Core\Entity\EntityInterface; -use Drupal\migrate\Plugin\migrate\destination\EntityConfigBase; - -/** - * @MigrateDestination( - * id = "entity:shortcut_set" - * ) - */ -class EntityShortcutSet extends EntityConfigBase { - - /** - * {@inheritdoc} - */ - protected function getEntity(Row $row, array $old_destination_id_values) { - $entity = parent::getEntity($row, $old_destination_id_values); - // Set the "syncing" flag to TRUE, to avoid duplication of default - // shortcut links - $entity->setSyncing(TRUE); - return $entity; - } -} diff --git a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php deleted file mode 100644 index 557fea36f280..000000000000 --- a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\shortcut\Plugin\migrate\destination\ShortcutSetUsers. - */ - -namespace Drupal\shortcut\Plugin\migrate\destination; - -use Drupal\shortcut\ShortcutSetStorageInterface; -use Drupal\user\Entity\User; -use Drupal\migrate\Entity\MigrationInterface; -use Drupal\migrate\Row; -use Drupal\migrate\Plugin\migrate\destination\DestinationBase; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; - -/** - * @MigrateDestination( - * id = "shortcut_set_users" - * ) - */ -class ShortcutSetUsers extends DestinationBase implements ContainerFactoryPluginInterface { - - /** - * The shortcut set storage handler. - * - * @var \Drupal\shortcut\ShortcutSetStorageInterface - */ - protected $shortcutSetStorage; - - /** - * Constructs an entity destination plugin. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param MigrationInterface $migration - * The migration. - * @param \Drupal\shortcut\ShortcutSetStorageInterface $shortcut_set_storage - * The shortcut_set entity storage handler. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, ShortcutSetStorageInterface $shortcut_set_storage) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); - $this->shortcutSetStorage = $shortcut_set_storage; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration, - $container->get('entity.manager')->getStorage('shortcut_set') - ); - } - - /** - * {@inheritdoc} - */ - public function getIds() { - return array( - 'set_name' => array( - 'type' => 'string', - ), - 'uid' => array( - 'type' => 'integer', - ), - ); - } - - /** - * {@inheritdoc} - */ - public function fields(MigrationInterface $migration = NULL) { - return [ - 'uid' => 'The users.uid for this set.', - 'source' => 'The shortcut_set.set_name that will be displayed for this user.', - ]; - } - - /** - * {@inheritdoc} - */ - public function import(Row $row, array $old_destination_id_values = array()) { - /** @var \Drupal\shortcut\ShortcutSetInterface $set */ - $set = $this->shortcutSetStorage->load($row->getDestinationProperty('set_name')); - /** @var \Drupal\user\UserInterface $account */ - $account = User::load($row->getDestinationProperty('uid')); - $this->shortcutSetStorage->assignUser($set, $account); - - return array($set->id(), $account->id()); - } - -} diff --git a/core/modules/shortcut/src/Plugin/migrate/source/d7/Shortcut.php b/core/modules/shortcut/src/Plugin/migrate/source/d7/Shortcut.php deleted file mode 100644 index 4b89bfa321a3..000000000000 --- a/core/modules/shortcut/src/Plugin/migrate/source/d7/Shortcut.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\shortcut\Plugin\migrate\source\d7\Shortcut. - */ - -namespace Drupal\shortcut\Plugin\migrate\source\d7; - -use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; - -/** - * Drupal 7 shortcut links source from database. - * - * @MigrateSource( - * id = "d7_shortcut", - * source_provider = "shortcut" - * ) - */ -class Shortcut extends DrupalSqlBase { - - /** - * {@inheritdoc} - */ - public function query() { - return $this->select('menu_links', 'ml') - ->fields('ml', array('mlid', 'menu_name', 'link_path', 'link_title', 'weight')) - ->condition('hidden', '0') - ->condition('menu_name', 'shortcut-set-%', 'LIKE'); - } - - /** - * {@inheritdoc} - */ - public function fields() { - return array( - 'mlid' => $this->t("The menu.mlid primary key for this menu item (= shortcut link)."), - 'menu_name' => $this->t("The menu_name (= set name) for this shortcut link."), - 'link_path' => $this->t("The link for this shortcut."), - 'link_title' => $this->t("The title for this shortcut."), - 'weight' => $this->t("The weight for this shortcut"), - ); - } - - /** - * {@inheritdoc} - */ - public function getIds() { - $ids['mlid']['type'] = 'integer'; - return $ids; - } - -} diff --git a/core/modules/shortcut/src/Plugin/migrate/source/d7/ShortcutSet.php b/core/modules/shortcut/src/Plugin/migrate/source/d7/ShortcutSet.php deleted file mode 100644 index 5735c490123d..000000000000 --- a/core/modules/shortcut/src/Plugin/migrate/source/d7/ShortcutSet.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSet. - */ - -namespace Drupal\shortcut\Plugin\migrate\source\d7; - -use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; - -/** - * Drupal 7 shortcut_set source from database. - * - * @MigrateSource( - * id = "d7_shortcut_set", - * source_provider = "shortcut" - * ) - */ -class ShortcutSet extends DrupalSqlBase { - - /** - * {@inheritdoc} - */ - public function query() { - return $this->select('shortcut_set', 'ss')->fields('ss'); - } - - /** - * {@inheritdoc} - */ - public function fields() { - return array( - 'set_name' => $this->t("The name under which the set's links are stored."), - 'title' => $this->t("The title of the set."), - ); - } - - /** - * {@inheritdoc} - */ - public function getIds() { - $ids['set_name']['type'] = 'string'; - return $ids; - } - -} diff --git a/core/modules/shortcut/src/Plugin/migrate/source/d7/ShortcutSetUsers.php b/core/modules/shortcut/src/Plugin/migrate/source/d7/ShortcutSetUsers.php deleted file mode 100644 index b0e23964eeb4..000000000000 --- a/core/modules/shortcut/src/Plugin/migrate/source/d7/ShortcutSetUsers.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSetUsers. - */ - -namespace Drupal\shortcut\Plugin\migrate\source\d7; - -use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; - -/** - * Drupal 7 shortcut_set_users source from database. - * - * @MigrateSource( - * id = "d7_shortcut_set_users", - * source_provider = "shortcut" - * ) - */ -class ShortcutSetUsers extends DrupalSqlBase { - - /** - * {@inheritdoc} - */ - public function query() { - return $this->select('shortcut_set_users', 'ssu')->fields('ssu'); - } - - /** - * {@inheritdoc} - */ - public function fields() { - return array( - 'uid' => $this->t('The users.uid for this set.'), - 'set_name' => $this->t('The shortcut_set.set_name that will be displayed for this user.'), - ); - } - - /** - * {@inheritdoc} - */ - public function getIds() { - return array( - 'set_name' => array( - 'type' => 'string', - ), - 'uid' => array( - 'type' => 'integer', - ), - ); - } - -} diff --git a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php b/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php deleted file mode 100644 index a1fb995c920f..000000000000 --- a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\shortcut\Tests\Migrate\d7\MigrateShortcutSetTest. - */ - -namespace Drupal\shortcut\Tests\Migrate\d7; - -use Drupal\shortcut\Entity\ShortcutSet; -use Drupal\shortcut\ShortcutSetInterface; -use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase; - -/** - * Test shortcut_set migration to ShortcutSet entities. - * - * @group shortcut - */ -class MigrateShortcutSetTest extends MigrateDrupal7TestBase { - - /** - * Modules to enable. - * - * @var array - */ - static $modules = array( - 'link', - 'field', - 'shortcut', - 'menu_link_content', - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - $this->installSchema('system', array('router')); - $this->installEntitySchema('shortcut'); - $this->installEntitySchema('menu_link_content'); - $this->executeMigration('d7_shortcut_set'); - $this->executeMigration('menu'); - $this->executeMigration('d7_menu_links'); - $this->executeMigration('d7_shortcut'); - } - - /** - * Test the shortcut set migration. - */ - public function testShortcutSetMigration() { - $this->assertEntity('default', 'Default', 2); - $this->assertEntity('shortcut_set_2', 'Alternative shortcut set', 2); - } - - /** - * Asserts various aspects of a shortcut set entity. - * - * @param string $id - * The expected shortcut set ID. - * @param string $label - * The expected shortcut set label. - * @param int $expected_size - * The number of shortcuts expected to be in the set. - */ - protected function assertEntity($id, $label, $expected_size) { - $shortcut_set = ShortcutSet::load($id); - $this->assertTrue($shortcut_set instanceof ShortcutSetInterface); - /** @var \Drupal\shortcut\ShortcutSetInterface $shortcut_set */ - $this->assertIdentical($id, $shortcut_set->id()); - $this->assertIdentical($label, $shortcut_set->label()); - - // Check the number of shortcuts in the set. - $shortcuts = $shortcut_set->getShortcuts(); - $this->assertIdentical(count($shortcuts), $expected_size); - } - -} diff --git a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetUsersTest.php b/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetUsersTest.php deleted file mode 100644 index c6d4530f1c62..000000000000 --- a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetUsersTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\shortcut\Tests\Migrate\d7\MigrateShortcutSetUsersTest. - */ - -namespace Drupal\shortcut\Tests\Migrate\d7; - -use Drupal\user\Entity\User; -use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase; - -/** - * Test shortcut_set_users migration. - * - * @group shortcut - */ -class MigrateShortcutSetUsersTest extends MigrateDrupal7TestBase { - - /** - * Modules to enable. - * - * @var array - */ - static $modules = array( - 'link', - 'field', - 'shortcut', - 'menu_link_content', - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - $this->installSchema('system', array('router')); - $this->installEntitySchema('shortcut'); - $this->installEntitySchema('menu_link_content'); - $this->installSchema('shortcut', ['shortcut_set_users']); - $this->executeMigration('d7_user_role'); - $this->executeMigration('d7_user'); - $this->executeMigration('d7_shortcut_set'); - $this->executeMigration('menu'); - $this->executeMigration('d7_menu_links'); - $this->executeMigration('d7_shortcut'); - $this->executeMigration('d7_shortcut_set_users'); - } - - /** - * Test the shortcut set migration. - */ - public function testShortcutSetUsersMigration() { - // Check if migrated user has correct migrated shortcut set assigned. - $account = User::load(2); - $shortcut_set = shortcut_current_displayed_set($account); - /** @var \Drupal\shortcut\ShortcutSetInterface $shortcut_set */ - $this->assertIdentical('shortcut_set_2', $shortcut_set->id()); - } - -} diff --git a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutTest.php b/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutTest.php deleted file mode 100644 index 8bf10ee0909d..000000000000 --- a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutTest.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\shortcut\Tests\Migrate\d7\MigrateShortcutTest. - */ - -namespace Drupal\shortcut\Tests\Migrate\d7; - -use Drupal\shortcut\Entity\Shortcut; -use Drupal\shortcut\ShortcutInterface; -use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase; - -/** - * Test shortcut menu links migration to Shortcut entities. - * - * @group shortcut - */ -class MigrateShortcutTest extends MigrateDrupal7TestBase { - - /** - * Modules to enable. - * - * @var array - */ - static $modules = array( - 'link', - 'field', - 'shortcut', - 'menu_link_content', - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - $this->installSchema('system', array('router')); - $this->installEntitySchema('shortcut'); - $this->installEntitySchema('menu_link_content'); - $this->executeMigration('d7_shortcut_set'); - $this->executeMigration('menu'); - $this->executeMigration('d7_menu_links'); - $this->executeMigration('d7_shortcut'); - } - - /** - * Asserts various aspects of a shortcut entity. - * - * @param int $id - * The shortcut ID. - * @param string $title - * The expected title of the shortcut. - * @param int $weight - * The expected weight of the shortcut. - * @param string $url - * The expected URL of the shortcut. - */ - protected function assertEntity($id, $title, $weight, $url) { - $shortcut = Shortcut::load($id); - $this->assertTrue($shortcut instanceof ShortcutInterface); - /** @var \Drupal\shortcut\ShortcutInterface $shortcut */ - $this->assertIdentical($title, $shortcut->getTitle()); - $this->assertIdentical($weight, $shortcut->getWeight()); - $this->assertIdentical($url, $shortcut->getUrl()->toString()); - } - - /** - * Test the shortcut migration. - */ - public function testShortcutMigration() { - // Check if the 4 shortcuts were migrated correctly. - $this->assertEntity(1, 'Add content', '-20', '/node/add'); - $this->assertEntity(2, 'Find content', '-19', '/admin/content'); - $this->assertEntity(3, 'Help', '-49', '/admin/help'); - $this->assertEntity(4, 'People', '-50', '/admin/people'); - } - -} 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 b0d92e8a1038..000000000000 --- a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7\ShortcutSetTest. - */ - -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 523fc45cfcda..000000000000 --- a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutSetUsersTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7\ShortcutSetUsersTest. - */ - -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 1aec26fe6eae..000000000000 --- a/core/modules/shortcut/tests/src/Unit/Plugin/migrate/source/d7/ShortcutTest.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7\ShortcutTest. - */ - -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(); - } - -} -- GitLab