You are here

public function LingotekContentTypeTranslationTest::testEditedContentTypeTranslation in Lingotek Translation 8

Tests that a config can be translated after edited.

File

src/Tests/LingotekContentTypeTranslationTest.php, line 106

Class

LingotekContentTypeTranslationTest
Tests translating a content type.

Namespace

Drupal\lingotek\Tests

Code

public function testEditedContentTypeTranslation() {

  // We need a config with translations first.
  $this
    ->testContentTypeTranslation();

  // Add a language so we can check that it's not marked as dirty if there are
  // no translations.
  ConfigurableLanguage::createFromLangcode('eu')
    ->setThirdPartySetting('lingotek', 'locale', 'eu_ES')
    ->save();

  // Edit the content type.
  $edit['name'] = 'Blogpost';
  $this
    ->drupalPostForm('/admin/structure/types/manage/article', $edit, t('Save content type'));
  $this
    ->assertText('The content type Blogpost has been updated.');
  $this
    ->clickLink(t('Translate'));

  // Check the status is not edited for Vasque, but available to request
  // translation.
  $this
    ->assertLinkByHref('admin/lingotek/config/request/node_type/article/eu_ES');
  $this
    ->clickLink(t('Request translation'), 1);
  $this
    ->assertText(t('Translation to es_MX requested successfully'));
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.added_target_locale'));

  // Recheck status.
  $this
    ->clickLink('Check Download');
  $this
    ->assertText('Translation to es_MX status checked successfully');

  // Download the translation.
  $this
    ->clickLink('Download');
  $this
    ->assertText('Translation to es_MX downloaded successfully');
}