You are here

public function LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission in Lingotek Translation 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  2. 4.0.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  3. 3.0.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  4. 3.2.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  5. 3.3.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  6. 3.4.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  7. 3.5.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  8. 3.6.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  9. 3.7.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()
  10. 3.8.x tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php \Drupal\Tests\lingotek\Functional\LingotekManageLingotekTranslationsPermissionTest::testCannotSeeSettingsTabWithoutRightPermission()

Test that if user can see settings tab without right permissions

File

tests/src/Functional/LingotekManageLingotekTranslationsPermissionTest.php, line 61

Class

LingotekManageLingotekTranslationsPermissionTest
Tests different permissions of the Lingotek module.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testCannotSeeSettingsTabWithoutRightPermission() {
  $assert_session = $this
    ->assertSession();
  $user = $this
    ->drupalCreateUser([
    'administer lingotek',
    'assign lingotek translation profiles',
    'manage lingotek translations',
  ]);

  // Login as user.
  $this
    ->drupalLogin($user);

  // Get the settings form.
  $this
    ->drupalGet('admin/lingotek/settings');

  // Assert translation profile can be assigned.
  $this
    ->assertNoText('You are not authorized to access this page.');
  $user = $this
    ->drupalCreateUser([
    'assign lingotek translation profiles',
    'manage lingotek translations',
  ]);

  // Login as user.
  $this
    ->drupalLogin($user);

  // Get the settings form.
  $this
    ->drupalGet('admin/lingotek/settings');

  // Assert translation profile cannot be assigned.
  $this
    ->assertText('You are not authorized to access this page.');
}