You are here

public function LingotekNodeTranslationTest::testCannotAssignProfileToContentWithoutRightPermission in Lingotek Translation 8

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

File

src/Tests/LingotekNodeTranslationTest.php, line 219

Class

LingotekNodeTranslationTest
Tests translating a node.

Namespace

Drupal\lingotek\Tests

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_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_profile');
}