public function EntityCloneMenuTest::testMenuEntityClone in Entity Clone 8
Test menu entity clone.
File
- tests/
src/ Functional/ EntityCloneMenuTest.php, line 58
Class
- EntityCloneMenuTest
- Create a menu and test a clone.
Namespace
Drupal\Tests\entity_clone\FunctionalCode
public function testMenuEntityClone() {
$menus = \Drupal::entityTypeManager()
->getStorage('menu')
->loadByProperties([
'id' => 'account',
]);
$menu = reset($menus);
$edit = [
'label' => 'Test menu cloned',
'id' => 'test-menu-cloned',
];
$this
->drupalPostForm('entity_clone/menu/' . $menu
->id(), $edit, t('Clone'));
$menus = \Drupal::entityTypeManager()
->getStorage('menu')
->loadByProperties([
'id' => $edit['id'],
]);
$menu = reset($menus);
$this
->assertInstanceOf(Menu::class, $menu, 'Test menu cloned found in database.');
}