MigrateShortcutSetTest.php in Zircon Profile 8
File
core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php
View source
<?php
namespace Drupal\shortcut\Tests\Migrate\d7;
use Drupal\shortcut\Entity\ShortcutSet;
use Drupal\shortcut\ShortcutSetInterface;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
class MigrateShortcutSetTest extends MigrateDrupal7TestBase {
static $modules = array(
'link',
'field',
'shortcut',
'menu_link_content',
);
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');
}
public function testShortcutSetMigration() {
$this
->assertEntity('default', 'Default', 2);
$this
->assertEntity('shortcut_set_2', 'Alternative shortcut set', 2);
}
protected function assertEntity($id, $label, $expected_size) {
$shortcut_set = ShortcutSet::load($id);
$this
->assertTrue($shortcut_set instanceof ShortcutSetInterface);
$this
->assertIdentical($id, $shortcut_set
->id());
$this
->assertIdentical($label, $shortcut_set
->label());
$shortcuts = $shortcut_set
->getShortcuts();
$this
->assertIdentical(count($shortcuts), $expected_size);
}
}