You are here

function ConfigSourceUiTest::testFieldConfigTranslateTabSingleCheckout in Translation Management Tool 8

Test the field config entity type for a single checkout.

File

sources/tmgmt_config/tests/src/Functional/ConfigSourceUiTest.php, line 280

Class

ConfigSourceUiTest
Content entity source UI tests.

Namespace

Drupal\Tests\tmgmt_config\Functional

Code

function testFieldConfigTranslateTabSingleCheckout() {
  $this
    ->loginAsAdmin(array(
    'translate configuration',
  ));

  // Add a continuous job.
  $job = $this
    ->createJob('en', 'de', 1, [
    'job_type' => Job::TYPE_CONTINUOUS,
  ]);
  $job
    ->save();

  // Go to sources, field configuration list.
  $this
    ->drupalGet('admin/tmgmt/sources/config/field_config');
  $this
    ->assertText(t('Configuration ID'));
  $this
    ->assertText('field.field.node.article.body');
  $edit = [
    'items[field.field.node.article.body]' => TRUE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Add to cart'));
  $this
    ->clickLink(t('cart'));
  $this
    ->assertText('Body');
  $edit = [
    'target_language[]' => 'de',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Request translation'));

  // Assert that we cannot add config entities into continuous jobs.
  $this
    ->assertNoText(t('Check for continuous jobs'));
  $this
    ->assertNoField('add_all_to_continuous_jobs');

  // Go to the translate tab.
  $this
    ->drupalGet('admin/structure/types/manage/article/fields/node.article.body/translate');

  // Request a german translation.
  $this
    ->drupalPostForm(NULL, array(
    'languages[de]' => TRUE,
  ), t('Request translation'));

  // Verify that we are on the checkout page.
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('One job needs to be checked out.'));
  $this
    ->drupalPostForm(NULL, array(), t('Submit to provider'));

  // Verify that the pending translation is shown.
  $this
    ->clickLinkWithImageTitle('Needs review');
  $this
    ->drupalPostForm(NULL, array(), t('Save as completed'));
}