Error message

  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1075 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1079 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).

function ConfigSourceUiTest::testFieldConfigTranslateTabSingleCheckout

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
    ->assertSession()
    ->pageTextContains('Configuration ID');
  $this
    ->assertSession()
    ->pageTextContains('field.field.node.article.body');
  $edit = [
    'items[field.field.node.article.body]' => TRUE,
  ];
  $this
    ->submitForm($edit, 'Add to cart');
  $this
    ->clickLink('cart');
  $this
    ->assertSession()
    ->pageTextContains('Body');
  $edit = [
    'target_language[]' => 'de',
  ];
  $this
    ->submitForm($edit, 'Request translation');

  // Assert that we cannot add config entities into continuous jobs.
  $this
    ->assertSession()
    ->pageTextNotContains('Check for continuous jobs');
  $this
    ->assertSession()
    ->fieldNotExists('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
    ->submitForm([
    'languages[de]' => TRUE,
  ], 'Request translation');

  // Verify that we are on the checkout page.
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('One job needs to be checked out.');
  $this
    ->submitForm([], 'Submit to provider');

  // Verify that the pending translation is shown.
  $this
    ->clickLinkWithImageTitle('Needs review');
  $this
    ->submitForm([], 'Save as completed');
}