You are here

public function LingotekFieldBodyBulkDebugTest::testDebugExport in Lingotek Translation 8

File

src/Tests/LingotekFieldBodyBulkDebugTest.php, line 71

Class

LingotekFieldBodyBulkDebugTest
Tests debugging a field using the bulk management form.

Namespace

Drupal\lingotek\Tests

Code

public function testDebugExport() {

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

  // Enable the debug operations.
  $this
    ->drupalGet('admin/lingotek/settings');
  $this
    ->drupalPostForm(NULL, [], t('Enable debug operations'));

  // Go to the bulk config management page.
  $this
    ->goToConfigBulkManagementForm('node_fields');
  $edit = [
    'table[node.article.body]' => TRUE,
    'operation' => 'debug.export',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Execute'));
  $this
    ->assertText('Exports available');

  // Download the file.
  $this
    ->clickLink('config.node.article.body.json');
  $response = json_decode($this->content, true);
  $this
    ->assertIdentical('Body', $response['field.field.node.article.body']['label']);
  $this
    ->assertIdentical('', $response['field.field.node.article.body']['description']);
  $this
    ->assertIdentical('node.article.body (config): Body', $response['_debug']['title']);
  $this
    ->assertIdentical('automatic', $response['_debug']['profile']);
  $this
    ->assertIdentical('en_US', $response['_debug']['source_locale']);
}