You are here

public function ContentTypePermissionsTest::test in Lightning Layout 8

Tests that the layout_manager role gets content type-based permissions.

File

tests/src/Kernel/ContentTypePermissionsTest.php, line 45

Class

ContentTypePermissionsTest
Tests content type-related permission handling in Lightning Layout.

Namespace

Drupal\Tests\lightning_layout\Kernel

Code

public function test() {
  $node_type = NodeType::create([
    'type' => $this
      ->randomMachineName(),
  ]);
  $node_type
    ->save();
  $role_id = 'layout_manager';
  $permission = 'administer panelizer node ' . $node_type
    ->id() . ' defaults';
  $this
    ->assertContains($permission, Role::load($role_id)
    ->getPermissions());
  $node_type
    ->delete();
  $this
    ->assertNotContains($permission, Role::load($role_id)
    ->getPermissions());
}