public function GroupContentMenuTest::testMultipleMenus in Group Content Menu 8
Test creation of a group content menu with multiple menu types available.
File
- tests/
src/ Functional/ GroupContentMenuTest.php, line 287
Class
- GroupContentMenuTest
- Test description.
Namespace
Drupal\Tests\group_content_menu\FunctionalCode
public function testMultipleMenus() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
/** @var \Behat\Mink\Element\DocumentElement $page */
$page = $this
->getSession()
->getPage();
// Generate Group Menu One content menu type.
$this
->drupalGet('admin/structure/group_content_menu_types/add');
$page
->fillField('label', 'Group Menu One');
$page
->fillField('id', 'group_menu_one');
$page
->pressButton('Save');
$assert
->statusCodeEquals(200);
$assert
->pageTextContains('The group menu type Group Menu One has been added.');
// Generate Group Menu Two content menu type.
$this
->drupalGet('admin/structure/group_content_menu_types/add');
$page
->fillField('label', 'Group Menu Two');
$page
->fillField('id', 'group_menu_two');
$page
->pressButton('Save');
$assert
->statusCodeEquals(200);
$assert
->pageTextContains('The group menu type Group Menu Two has been added.');
// Enable the group content plugins for the default group type.
$this
->drupalGet('/admin/group/content/install/default/group_content_menu:group_menu_one');
$page
->pressButton('Install plugin');
$assert
->pageTextContains('The content plugin was installed on the group type. ');
$this
->drupalGet('/admin/group/content/install/default/group_content_menu:group_menu_two');
$page
->pressButton('Install plugin');
$assert
->pageTextContains('The content plugin was installed on the group type.');
// Add a group.
$this
->drupalGet('/group/add/default');
$group_title = $this
->randomString();
$page
->fillField('label[0][value]', $group_title);
$page
->pressButton('Create Default label and complete your membership');
$page
->pressButton('Save group and membership');
$assert
->statusCodeEquals(200);
// Create a group content menu.
$this
->drupalGet('group/1/menu/add');
$page
->clickLink('Group menu (Group Menu Two)');
$assert
->statusCodeEquals(200);
$menu_title = $this
->randomString();
$page
->fillField('label[0][value]', $menu_title);
$page
->pressButton('Save');
$assert
->pageTextContains("New group menu {$menu_title} has been created.");
}