class MigrateShortcutSetTest
Same name and namespace in other branches
- 11.x core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutSetTest.php \Drupal\Tests\shortcut\Kernel\Migrate\d7\MigrateShortcutSetTest
- 10 core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutSetTest.php \Drupal\Tests\shortcut\Kernel\Migrate\d7\MigrateShortcutSetTest
- 8.9.x core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutSetTest.php \Drupal\Tests\shortcut\Kernel\Migrate\d7\MigrateShortcutSetTest
Test shortcut_set migration to ShortcutSet entities.
@group shortcut
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase implements \Drupal\migrate\MigrateMessageInterface extends \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase extends \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait extends \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\shortcut\Kernel\Migrate\d7\MigrateShortcutSetTest extends \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait extends \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase extends \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase implements \Drupal\migrate\MigrateMessageInterface extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MigrateShortcutSetTest
File
-
core/
modules/ shortcut/ tests/ src/ Kernel/ Migrate/ d7/ MigrateShortcutSetTest.php, line 14
Namespace
Drupal\Tests\shortcut\Kernel\Migrate\d7View source
class MigrateShortcutSetTest extends MigrateDrupal7TestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'link',
'field',
'shortcut',
'menu_link_content',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('shortcut');
$this->installEntitySchema('menu_link_content');
$this->executeMigration('d7_shortcut_set');
$this->executeMigration('d7_menu');
$this->executeMigration('d7_shortcut');
}
/**
* Tests 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.
*
* @internal
*/
protected function assertEntity(string $id, string $label, int $expected_size) : void {
$shortcut_set = ShortcutSet::load($id);
$this->assertInstanceOf(ShortcutSetInterface::class, $shortcut_set);
/** @var \Drupal\shortcut\ShortcutSetInterface $shortcut_set */
$this->assertSame($id, $shortcut_set->id());
$this->assertSame($label, $shortcut_set->label());
// Check the number of shortcuts in the set.
$shortcuts = $shortcut_set->getShortcuts();
$this->assertCount($expected_size, $shortcuts);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.