function DevelGenerateCommandsTest::testDrushGenerateMenus
Same name in other branches
- 4.x devel_generate/tests/src/Functional/DevelGenerateCommandsTest.php \Drupal\Tests\devel_generate\Functional\DevelGenerateCommandsTest::testDrushGenerateMenus()
Tests generating menus.
File
-
devel_generate/
tests/ src/ Functional/ DevelGenerateCommandsTest.php, line 124
Class
- DevelGenerateCommandsTest
- Test class for the Devel Generate drush commands.
Namespace
Drupal\Tests\devel_generate\FunctionalCode
public function testDrushGenerateMenus() : void {
$generatedMenu = NULL;
// Make sure menus, and with correct properties.
$this->drush(DevelGenerateCommands::MENUS, [
'1',
'5',
], [
'kill' => NULL,
]);
$menus = Menu::loadMultiple();
foreach ($menus as $menu) {
if (str_contains($menu->id(), 'devel-')) {
// We have a menu that we created.
$generatedMenu = $menu;
break;
}
}
$link = MenuLinkContent::load(5);
$this->assertNotNull($generatedMenu, 'Generated menu successfully.');
$this->assertNotNull($link, 'Generated link successfully.');
$this->assertEquals($generatedMenu->id(), $link->getMenuName(), 'Generated menu ID matches link menu name.');
}