You are here

public function MediaTest::testPermissions in Drupal 9

Tests permissions based on a media type have the correct permissions.

File

core/modules/media/tests/src/Kernel/MediaTest.php, line 40

Class

MediaTest
Tests Media.

Namespace

Drupal\Tests\media\Kernel

Code

public function testPermissions() {
  $permissions = $this->container
    ->get('user.permissions')
    ->getPermissions();
  $name = "create {$this->testMediaType->id()} media";
  $this
    ->assertArrayHasKey($name, $permissions);
  $this
    ->assertSame([
    'config' => [
      $this->testMediaType
        ->getConfigDependencyName(),
    ],
  ], $permissions[$name]['dependencies']);
}