You are here

public function LingotekContentTypeBulkDebugTest::testDebugExport in Lingotek Translation 8

File

src/Tests/LingotekContentTypeBulkDebugTest.php, line 69

Class

LingotekContentTypeBulkDebugTest
Tests debugging a config entity 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_type');
  $edit = [
    'table[article]' => TRUE,
    // System information.
    'operation' => 'debug.export',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Execute'));
  $this
    ->assertText('Exports available');

  // Download the file.
  $this
    ->clickLink('config.node_type.json');
  $response = json_decode($this->content, true);
  $this
    ->assertIdentical('Article', $response['node.type.article']['name']);
  $this
    ->assertIdentical(NULL, $response['node.type.article']['description']);
  $this
    ->assertIdentical(NULL, $response['node.type.article']['help']);
  $this
    ->assertIdentical('node_type (config): Article content type', $response['_debug']['title']);
  $this
    ->assertIdentical('automatic', $response['_debug']['profile']);
  $this
    ->assertIdentical('en_US', $response['_debug']['source_locale']);
}