You are here

public function LingotekManageTranslationsPostUpdateTest::testLingotekManageTranslationsPermissionPostUpdate in Lingotek Translation 8.2

Tests that the Lingotek role has the new permission.

File

tests/src/Functional/Update/LingotekManageTranslationsPostUpdateTest.php, line 28

Class

LingotekManageTranslationsPostUpdateTest
Tests the upgrade path for updating the Lingotek administration roles with the manage translations permission.

Namespace

Drupal\Tests\lingotek\Functional\Update

Code

public function testLingotekManageTranslationsPermissionPostUpdate() {

  // The role doesn't have the permission.
  $role = Role::load('translation_manager');
  $this
    ->assertFalse($role
    ->hasPermission('manage lingotek translations'), "The Translation Manager role doesn't have the 'Manage Lingotek Translations' permission.");
  $this
    ->assertTrue($role
    ->hasPermission('administer lingotek'), "The Translation Manager role has the 'Administer Lingotek' permission.");
  $this
    ->runUpdates();

  // The role now has the permission.
  $role = Role::load('translation_manager');
  $this
    ->assertTrue($role
    ->hasPermission('manage lingotek translations'), "The Translation Manager role has the 'Manage Lingotek Translations' permission.");
  $this
    ->assertTrue($role
    ->hasPermission('administer lingotek'), "The Translation Manager role has the 'Administer Lingotek' permission.");
}