class UpdateAddViewUpdateNotificationsPermissionTest
Tests update_post_update_add_view_update_notifications_permission().
@group Update @group legacy
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Update\UpdatePathTestBase uses \Drupal\Tests\UpdatePathTestTrait implements \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\update\Functional\Update\UpdateAddViewUpdateNotificationsPermissionTest uses \Drupal\Tests\user\Traits\UserCreationTrait implements \Drupal\FunctionalTests\Update\UpdatePathTestBase
- class \Drupal\FunctionalTests\Update\UpdatePathTestBase uses \Drupal\Tests\UpdatePathTestTrait implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of UpdateAddViewUpdateNotificationsPermissionTest
File
-
core/
modules/ update/ tests/ src/ Functional/ Update/ UpdateAddViewUpdateNotificationsPermissionTest.php, line 15
Namespace
Drupal\Tests\update\Functional\UpdateView source
class UpdateAddViewUpdateNotificationsPermissionTest extends UpdatePathTestBase {
use UserCreationTrait;
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() : void {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-9.3.0.filled.standard.php.gz',
];
}
/**
* Tests that the 'view update notifications' permission is correctly granted.
*/
public function testViewUpdateNotificationsPermission() : void {
// Add a new 'Junior Admin' role with the legacy permission we care about.
$junior_admin = $this->createRole([
'administer site configuration',
], 'junior_admin', 'Junior Admin');
$role = Role::load('junior_admin');
$this->assertTrue($role->hasPermission('administer site configuration'), 'Junior Admin role has legacy permission.');
$this->assertFalse($role->hasPermission('view update notifications'), 'Junior Admin role does not have the new permission.');
$this->runUpdates();
$role = Role::load('junior_admin');
$this->assertTrue($role->hasPermission('administer site configuration'), 'Junior Admin role still has the legacy permission.');
$this->assertTrue($role->hasPermission('view update notifications'), 'Junior Admin role now has the new permission.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.