You are here

public function MediaTest::testPermissions in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaTest.php \Drupal\Tests\media\Kernel\MediaTest::testPermissions()

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']);
}