protected function MigrateMenuLinkTest::assertEntity in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/menu_link_content/src/Tests/Migrate/d7/MigrateMenuLinkTest.php \Drupal\menu_link_content\Tests\Migrate\d7\MigrateMenuLinkTest::assertEntity()
Asserts various aspects of a menu link entity.
Parameters
string $id: The link ID.
string $title: The expected title of the link.
string $menu: The expected ID of the menu to which the link will belong.
string $description: The link's expected description.
bool $enabled: Whether the link is enabled.
bool $expanded: Whether the link is expanded
array $attributes: Additional attributes the link is expected to have.
string $uri: The expected URI of the link.
int $weight: The expected weight of the link.
2 calls to MigrateMenuLinkTest::assertEntity()
- MigrateMenuLinkTest::testMenuLinks in core/
modules/ menu_link_content/ src/ Tests/ Migrate/ d7/ MigrateMenuLinkTest.php - Tests migration of menu links.
- MigrateMenuLinkTest::testUndefinedLinkTitle in core/
modules/ menu_link_content/ src/ Tests/ Migrate/ d7/ MigrateMenuLinkTest.php - Tests migrating a link with an undefined title attribute.
File
- core/
modules/ menu_link_content/ src/ Tests/ Migrate/ d7/ MigrateMenuLinkTest.php, line 59 - Contains \Drupal\menu_link_content\Tests\Migrate\d7\MigrateMenuLinkTest.
Class
- MigrateMenuLinkTest
- Menu link migration.
Namespace
Drupal\menu_link_content\Tests\Migrate\d7Code
protected function assertEntity($id, $title, $menu, $description, $enabled, $expanded, array $attributes, $uri, $weight) {
/** @var \Drupal\menu_link_content\MenuLinkContentInterface $menu_link */
$menu_link = MenuLinkContent::load($id);
$this
->assertTrue($menu_link instanceof MenuLinkContentInterface);
$this
->assertIdentical($title, $menu_link
->getTitle());
$this
->assertIdentical($menu, $menu_link
->getMenuName());
// The migration sets the description of the link to the value of the
// 'title' attribute. Bit strange, but there you go.
$this
->assertIdentical($description, $menu_link
->getDescription());
$this
->assertIdentical($enabled, $menu_link
->isEnabled());
$this
->assertIdentical($expanded, $menu_link
->isExpanded());
$this
->assertIdentical($attributes, $menu_link->link->options);
$this
->assertIdentical($uri, $menu_link->link->uri);
$this
->assertIdentical($weight, $menu_link
->getWeight());
}