You are here

public function LingotekEntityTestBulkTranslationTest::testCannotAssignProfileToContentWithoutRightPermission in Lingotek Translation 4.0.x

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

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

File

tests/src/Functional/LingotekEntityTestBulkTranslationTest.php, line 511

Class

LingotekEntityTestBulkTranslationTest
Tests translating the entity test using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testCannotAssignProfileToContentWithoutRightPermission() {
  $editor = $this
    ->drupalCreateUser([
    'administer entity_test content',
    'view test entity',
  ]);

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

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

  // Assert translation profile cannot be assigned.
  $this
    ->assertNoField('lingotek_translation_management[lingotek_translation_profile]');
  $translation_manager = $this
    ->drupalCreateUser([
    'administer entity_test content',
    'view test entity',
    'assign lingotek translation profiles',
  ]);

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

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

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

  // Create a entity_test_mul.
  $edit = [];
  $edit['name[0][value]'] = 'Llamas are cool';
  $edit['field_test_text[0][value]'] = 'Llamas are very cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
  $this
    ->drupalPostForm('/entity_test_mul/add/entity_test_mul', $edit, t('Save'));
  $this
    ->clickLink('Edit');
  $this
    ->assertFieldById('edit-lingotek-translation-management-lingotek-translation-profile', 'manual');
}