protected function LingotekNodeEmbeddingContactFormTranslationTest::setUp in Lingotek Translation 3.3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 4.0.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 3.0.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 3.1.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 3.2.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 3.4.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 3.5.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 3.6.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 3.7.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
- 3.8.x tests/src/Functional/LingotekNodeEmbeddingContactFormTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeEmbeddingContactFormTranslationTest::setUp()
Overrides LingotekTestBase::setUp
File
- tests/
src/ Functional/ LingotekNodeEmbeddingContactFormTranslationTest.php, line 42
Class
- LingotekNodeEmbeddingContactFormTranslationTest
- Tests translating a node with multiple locales embedding another config entity.
Namespace
Drupal\Tests\lingotek\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Place the actions and title block.
$this
->drupalPlaceBlock('local_tasks_block');
$this
->drupalPlaceBlock('page_title_block');
// Create Article node types.
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
$this->contactForm = ContactForm::create([
'id' => 'contact_form',
'label' => 'Test contact form',
]);
$this->contactForm
->save();
$this
->createEntityReferenceField('node', 'article', 'field_contact_form', 'Contact Form', 'contact_form');
EntityFormDisplay::load('node.article.default')
->setComponent('field_contact_form', [
'type' => 'entity_reference_autocomplete',
])
->save();
EntityViewDisplay::load('node.article.default')
->setComponent('field_contact_form')
->save();
// Add locales.
ConfigurableLanguage::createFromLangcode('es')
->setThirdPartySetting('lingotek', 'locale', 'es_AR')
->save();
ConfigurableLanguage::createFromLangcode('es-es')
->setThirdPartySetting('lingotek', 'locale', 'es_ES')
->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();
$this
->saveLingotekContentTranslationSettings([
'node' => [
'article' => [
'profiles' => 'automatic',
'fields' => [
'title' => 1,
'body' => 1,
'field_contact_form' => 1,
],
],
],
]);
// This is a hack for avoiding writing different lingotek endpoint mocks.
\Drupal::state()
->set('lingotek.uploaded_content_type', 'node+contact_form');
}