protected function LingotekNodeExistingBulkTranslationTest::setUp in Lingotek Translation 3.3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 4.0.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 3.0.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 3.1.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 3.2.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 3.4.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 3.5.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 3.6.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 3.7.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
- 3.8.x tests/src/Functional/LingotekNodeExistingBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeExistingBulkTranslationTest::setUp()
Throws
\Exception
Overrides LingotekTestBase::setUp
1 call to LingotekNodeExistingBulkTranslationTest::setUp()
- LingotekNodeExistingBulkViewsTranslationTest::setUp in tests/
src/ Functional/ Views/ LingotekNodeExistingBulkViewsTranslationTest.php
1 method overrides LingotekNodeExistingBulkTranslationTest::setUp()
- LingotekNodeExistingBulkViewsTranslationTest::setUp in tests/
src/ Functional/ Views/ LingotekNodeExistingBulkViewsTranslationTest.php
File
- tests/
src/ Functional/ LingotekNodeExistingBulkTranslationTest.php, line 31
Class
- LingotekNodeExistingBulkTranslationTest
- Tests translating a node using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Login as admin.
$this
->drupalLogin($this->rootUser);
// Create Article node types.
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
// Create a node.
$edit = [];
$edit['title[0][value]'] = 'Llamas are cool';
$edit['body[0][value]'] = 'Llamas are very cool';
$this
->saveAndPublishNodeForm($edit);
// Add a language.
ConfigurableLanguage::createFromLangcode('es')
->setThirdPartySetting('lingotek', 'locale', 'es_MX')
->save();
// Enable translation for the current entity type and ensure the change is
// picked up.
ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'article', TRUE);
drupal_static_reset();
\Drupal::entityTypeManager()
->clearCachedDefinitions();
$this
->applyEntityUpdates();
// Rebuild the container so that the new languages are picked up by services
// that hold a list of languages.
$this
->rebuildContainer();
/** @var \Drupal\node\NodeInterface $node */
$node = Node::load(1);
$node
->addTranslation('es', [
'title' => 'Llamas are cool ES',
'body' => 'Llamas are very cool ES',
]);
$node
->save();
$this
->drupalGet('node/1/translations');
$this
->saveLingotekContentTranslationSettingsForNodeTypes();
}