You are here

protected function GroupContentMenuTest::setUp in Group Content Menu 8

Overrides GroupBrowserTestBase::setUp

File

tests/src/Functional/GroupContentMenuTest.php, line 30

Class

GroupContentMenuTest
Test description.

Namespace

Drupal\Tests\group_content_menu\Functional

Code

protected function setUp() : void {
  parent::setUp();

  // Add group permissions.
  $role = GroupType::load('default')
    ->getMemberRole();
  $role
    ->grantPermissions([
    'access group content menu overview',
    'create group_content_menu:group_menu content',
    'manage group_content_menu',
  ]);
  $role
    ->save();

  // Create a basic page content type with a default menu.
  $type = $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
    'display_submitted' => FALSE,
  ]);
  $type
    ->setThirdPartySetting('menu_ui', 'available_menus', [
    'main',
  ]);
  $type
    ->save();

  // Create an article content type, without any default menu.
  $type = $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
    'display_submitted' => FALSE,
  ]);
  $type
    ->setThirdPartySetting('menu_ui', 'available_menus', []);
  $type
    ->save();
}