function MediaTest::testPermissions

Same name in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaTest.php \Drupal\Tests\media\Kernel\MediaTest::testPermissions()
  2. 10 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 42

Class

MediaTest
Tests Media.

Namespace

Drupal\Tests\media\Kernel

Code

public function testPermissions() : void {
    $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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.