public function MediaUpdateTest::testBundlePermission in Drupal 8
Tests that media permissions are correctly migrated.
See also
File
- core/
modules/ media/ tests/ src/ Functional/ Update/ MediaUpdateTest.php, line 36
Class
- MediaUpdateTest
- Tests that media settings are properly updated during database updates.
Namespace
Drupal\Tests\media\Functional\UpdateCode
public function testBundlePermission() {
$this
->runUpdates();
/** @var \Drupal\user\RoleInterface $role */
$role = Role::load(Role::AUTHENTICATED_ID);
$media_types = \Drupal::entityQuery('media_type')
->execute();
foreach ($media_types as $media_type) {
$this
->assertTrue($role
->hasPermission("create {$media_type} media"));
$this
->assertTrue($role
->hasPermission("edit own {$media_type} media"));
$this
->assertTrue($role
->hasPermission("edit any {$media_type} media"));
$this
->assertTrue($role
->hasPermission("delete own {$media_type} media"));
$this
->assertTrue($role
->hasPermission("delete any {$media_type} media"));
}
}