LingotekNotEnabledNodeBulkTranslationTest.php in Lingotek Translation 8.2
File
tests/src/Functional/LingotekNotEnabledNodeBulkTranslationTest.php
View source
<?php
namespace Drupal\Tests\lingotek\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language\Entity\ContentLanguageSettings;
use Drupal\lingotek\Lingotek;
class LingotekNotEnabledNodeBulkTranslationTest extends LingotekTestBase {
public static $modules = [
'block',
'node',
];
protected $node;
protected function setUp() {
parent::setUp();
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Page',
]);
ConfigurableLanguage::createFromLangcode('es')
->setThirdPartySetting('lingotek', 'locale', 'es_MX')
->save();
ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'article', TRUE);
drupal_static_reset();
\Drupal::entityTypeManager()
->clearCachedDefinitions();
$this
->applyEntityUpdates();
$this
->rebuildContainer();
$this
->saveLingotekContentTranslationSettingsForNodeTypes();
}
public function testNodeTranslationUsingLinks() {
$edit = [];
$edit['title[0][value]'] = 'Llamas are cool';
$edit['body[0][value]'] = 'Llamas are very cool';
$this
->saveAndPublishNodeForm($edit, 'page');
$this
->drupalLogin($this->translationManagerUser);
$this
->goToContentBulkManagementForm();
$this
->assertLingotekUploadLink();
$this
->assertNoLingotekRequestTranslationLink('es_MX');
$this
->clickLink('EN');
$this
->assertText('The upload for node Llamas are cool failed. Check your configuration and profile and try again.');
$this
->assertNull(\Drupal::state()
->get('lingotek.uploaded_locale'));
$this
->assertNoSourceStatus('EN', Lingotek::STATUS_IMPORTING);
$this
->assertSourceStatus('EN', Lingotek::STATUS_UNTRACKED);
$this
->assertLingotekUploadLink();
}
}