public function MenuLinkTest::testMenuLinksInDifferentWorkspaces in Multiversion 8
File
- tests/
src/ Functional/ MenuLinkTest.php, line 60
Class
- MenuLinkTest
- Tests menu links deletion.
Namespace
Drupal\Tests\multiversion\FunctionalCode
public function testMenuLinksInDifferentWorkspaces() {
/** @var MenuLinkContentInterface $pineapple */
$pineapple = MenuLinkContent::create([
'menu_name' => 'main',
'link' => 'route:user.page',
'title' => 'Pineapple',
]);
$pineapple
->save();
$this
->assertEqual($pineapple
->get('workspace')->target_id, $this->initialWorkspace
->id(), 'Pineapple in initial workspace');
$this
->assertNotEqual($pineapple
->get('workspace')->target_id, $this->newWorkspace
->id(), 'Pineapple not in new workspace');
$this->workspaceManager
->setActiveWorkspace($this->newWorkspace);
// Save another menu link.
/** @var MenuLinkContentInterface $pear */
$pear = MenuLinkContent::create([
'menu_name' => 'main',
'link' => 'route:user.page',
'title' => 'Pear',
]);
$pear
->save();
$this
->assertEqual($pear
->get('workspace')->target_id, $this->newWorkspace
->id(), 'Pear in new workspace');
$this
->assertNotEqual($pear
->get('workspace')->target_id, $this->initialWorkspace
->id(), 'Pear not in initial workspace');
}