You are here

public function MenuAdminPerMenuPermissionsTest::testPermissions in Menu Admin per Menu 8

Test the permissions created by MenuAdminPerMenuPermissions.

@covers ::permissions

File

tests/src/Kernel/MenuAdminPerMenuPermissionsTest.php, line 58

Class

MenuAdminPerMenuPermissionsTest
Class MenuAdminPerMenuPermissionsTest.

Namespace

Drupal\Tests\menu_admin_per_menu\Kernel

Code

public function testPermissions() {
  $this
    ->assertEquals([
    'administer admin menu items',
    'administer footer menu items',
    'administer main menu items',
    'administer tools menu items',
    'administer account menu items',
  ], array_keys($this->menuAdminPerMenuPermissions
    ->permissions()));
  $menu = $this->menuStorage
    ->create([
    'id' => 'my_custom_menu',
    'label' => 'My custom menu',
  ]);
  $menu
    ->save();
  $this
    ->assertEquals([
    'administer admin menu items',
    'administer footer menu items',
    'administer main menu items',
    'administer my_custom_menu menu items',
    'administer tools menu items',
    'administer account menu items',
  ], array_keys($this->menuAdminPerMenuPermissions
    ->permissions()));
  $this->menuStorage
    ->delete([
    $menu,
  ]);
  $this
    ->assertEquals([
    'administer admin menu items',
    'administer footer menu items',
    'administer main menu items',
    'administer tools menu items',
    'administer account menu items',
  ], array_keys($this->menuAdminPerMenuPermissions
    ->permissions()));
}