MigrateShortcutTest.php in Zircon Profile 8
File
core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutTest.php
View source
<?php
namespace Drupal\shortcut\Tests\Migrate\d7;
use Drupal\shortcut\Entity\Shortcut;
use Drupal\shortcut\ShortcutInterface;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
class MigrateShortcutTest 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');
}
protected function assertEntity($id, $title, $weight, $url) {
$shortcut = Shortcut::load($id);
$this
->assertTrue($shortcut instanceof ShortcutInterface);
$this
->assertIdentical($title, $shortcut
->getTitle());
$this
->assertIdentical($weight, $shortcut
->getWeight());
$this
->assertIdentical($url, $shortcut
->getUrl()
->toString());
}
public function testShortcutMigration() {
$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');
}
}