You are here

public function ContentRoleTest::test in Lightning Core 8

Same name and namespace in other branches
  1. 8.2 modules/lightning_roles/tests/src/Kernel/ContentRoleTest.php \Drupal\Tests\lightning_roles\Kernel\ContentRoleTest::test()
  2. 8.3 modules/lightning_roles/tests/src/Kernel/ContentRoleTest.php \Drupal\Tests\lightning_roles\Kernel\ContentRoleTest::test()

File

modules/lightning_roles/tests/src/Kernel/ContentRoleTest.php, line 34

Class

ContentRoleTest
@group lightning @group lightning_roles

Namespace

Drupal\Tests\lightning_roles\Kernel

Code

public function test() {
  $node_type = NodeType::create([
    'type' => $this
      ->randomMachineName(),
  ]);
  $node_type
    ->save();
  $role_ids = [
    $node_type
      ->id() . '_creator',
    $node_type
      ->id() . '_reviewer',
  ];
  $roles = Role::loadMultiple($role_ids);
  $this
    ->assertCount(2, $roles);
  foreach ($roles as $role) {
    $this
      ->assertSame(FALSE, $role
      ->get('is_admin'));
  }
  $node_type
    ->delete();
  $this
    ->assertEmpty(Role::loadMultiple($role_ids));
}