You are here

public function LingotekNodeBulkDebugTest::testDebugExport in Lingotek Translation 3.4.x

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

File

tests/src/Functional/LingotekNodeBulkDebugTest.php, line 75

Class

LingotekNodeBulkDebugTest
Tests debugging a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testDebugExport() {

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

  // Create a node.
  $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]'] = 'manual';
  $this
    ->saveAndPublishNodeForm($edit);

  // Enable the debug operations.
  $this
    ->drupalGet('admin/lingotek/settings');
  $this
    ->drupalPostForm(NULL, [], t('Enable debug operations'));
  $this
    ->goToContentBulkManagementForm();
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => 'debug.export',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertText('Exports available');

  // Download the file.
  $this
    ->clickLink('node.article.1.json');
  $response = json_decode($this
    ->getSession()
    ->getPage()
    ->getContent(), TRUE);
  $this
    ->assertIdentical('Llamas are cool', $response['title'][0]['value']);
  $this
    ->assertIdentical('Llamas are very cool', $response['body'][0]['value']);
  $this
    ->assertIdentical('article (node): Llamas are cool', $response['_debug']['title']);
  $this
    ->assertIdentical('manual', $response['_debug']['profile']);
  $this
    ->assertIdentical('en_US', $response['_debug']['source_locale']);
}