You are here

public function LingotekWorkbenchModerationTest::testDownloadFromUploadStateTriggersATransition in Lingotek Translation 3.3.x

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

Download from upload state triggers a transition.

File

tests/src/Functional/LingotekWorkbenchModerationTest.php, line 341

Class

LingotekWorkbenchModerationTest
Tests setting up the integration with workbench moderation.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testDownloadFromUploadStateTriggersATransition() {
  $this
    ->configureNeedsReviewAsUploadState();
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool';
  $edit['body[0][value]'] = 'Llamas are very cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'automatic';
  $this
    ->drupalPostForm('/node/add/article', $edit, t('Save and Create New Draft'));

  // The status is draft.
  $value = $this
    ->xpath('//div[@id="edit-current"]/text()');
  $value = trim($value[1]
    ->getText());
  $this
    ->assertEqual($value, 'Draft', 'Workbench current status is draft');

  // Moderate to Needs review, so it's uploaded.
  $edit = [
    'new_state' => 'needs_review',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Apply');

  // The status is needs review.
  $value = $this
    ->xpath('//div[@id="edit-current"]/text()');
  $value = trim($value[1]
    ->getText());
  $this
    ->assertEqual($value, 'Needs Review', 'Workbench current status is Needs Review');
  $this
    ->goToContentBulkManagementForm();

  // Request translation.
  $this
    ->clickLink('ES');

  // Check translation.
  $this
    ->clickLink('ES');

  // Download translation.
  $this
    ->clickLink('ES');

  // Let's see the current status is modified.
  $this
    ->clickLink('Llamas are cool');
  $this
    ->assertNoFieldByName('new_state', 'The transition to a new workbench status happened (so no moderation form is shown).');
}