You are here

public function LingotekContentTypeBulkLocaleTranslationTest::testSourceUpdatedAfterRequestingTranslation in Lingotek Translation 8

Tests that source is updated after requesting translation.

File

src/Tests/LingotekContentTypeBulkLocaleTranslationTest.php, line 133

Class

LingotekContentTypeBulkLocaleTranslationTest
Tests translating a config entity into locales using the bulk management form.

Namespace

Drupal\lingotek\Tests

Code

public function testSourceUpdatedAfterRequestingTranslation() {

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

  // Go to the bulk config management page.
  $this
    ->goToConfigBulkManagementForm('node_type');
  $basepath = \Drupal::request()
    ->getBasePath();

  // Upload it
  $this
    ->clickLink('EN');
  $this
    ->assertText(t('Article uploaded successfully'));

  // There is a link for checking status.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/check_upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');

  // And we can already request a translation.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/request/node_type/article/de_AT?destination=' . $basepath . '/admin/lingotek/config/manage');

  // Request the German (AT) translation.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/request/node_type/article/de_AT?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('DE-AT');
  $this
    ->assertText("Translation to de_AT requested successfully");

  // Check that the source status has been updated.
  $this
    ->assertNoLinkByHref($basepath . '/admin/lingotek/config/check_upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
}