public function GroupContentMenuTest::testAddMenuManually in Group Content Menu 8
Test adding the group content menu item manually.
File
- tests/
src/ Functional/ GroupContentMenuTest.php, line 245
Class
- GroupContentMenuTest
- Test description.
Namespace
Drupal\Tests\group_content_menu\FunctionalCode
public function testAddMenuManually() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
/** @var \Behat\Mink\Element\DocumentElement $page */
$page = $this
->getSession()
->getPage();
// Generate a group content menu type.
$this
->drupalGet('admin/structure/group_content_menu_types');
$page
->clickLink('Add group menu type');
$assert
->statusCodeEquals(200);
$page
->fillField('label', 'Group Menu');
$page
->fillField('id', 'group_menu');
$page
->pressButton('Save');
$assert
->statusCodeEquals(200);
$assert
->pageTextContains('The group menu type Group Menu has been added.');
// Enable the group content plugin.
$this
->drupalGet('/admin/group/content/install/default/group_content_menu:group_menu');
$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');
// Create new group content menu.
$this
->drupalGet('/group/1/menu/add');
$menu_label = $this
->randomString();
$page
->fillField('label[0][value]', $menu_label);
$page
->pressButton('Save');
// Only one group content menu instance is created.
$this
->drupalGet('/group/1/content');
$assert
->pageTextContainsOnce($menu_label);
}