You are here

public function LingotekNodeTranslationTest::testCannotAssignProfileToContentWithoutRightPermission in Lingotek Translation 3.4.x

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

Test that when a node is created we cannot assign a profile if using a restricted user.

File

tests/src/Functional/LingotekNodeTranslationTest.php, line 419

Class

LingotekNodeTranslationTest
Tests translating a node.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testCannotAssignProfileToContentWithoutRightPermission() {
  $editor = $this
    ->drupalCreateUser([
    'bypass node access',
  ]);

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

  // Get the node form.
  $this
    ->drupalGet('node/add/article');

  // Assert translation profile cannot be assigned.
  $this
    ->assertNoField('lingotek_translation_management[lingotek_translation_profile]');
  $translation_manager = $this
    ->drupalCreateUser([
    'bypass node access',
    'assign lingotek translation profiles',
  ]);

  // Login as translation manager.
  $this
    ->drupalLogin($translation_manager);

  // Get the node form.
  $this
    ->drupalGet('node/add/article');

  // Assert translation profile can be assigned.
  $this
    ->assertField('lingotek_translation_management[lingotek_translation_profile]');
}