protected function LingotekContentTranslationPreSaveHookTest::setUp in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 4.0.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 3.0.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 3.1.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 3.2.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 3.3.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 3.4.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 3.5.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 3.7.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
- 3.8.x tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTranslationPreSaveHookTest::setUp()
Overrides LingotekTestBase::setUp
File
- tests/
src/ Functional/ LingotekContentTranslationPreSaveHookTest.php, line 39
Class
- LingotekContentTranslationPreSaveHookTest
- Tests the hooks a node.
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');
$this
->drupalCreateContentType([
'type' => 'press_release',
'name' => 'Press Release',
]);
$this
->createImageField('field_image', 'press_release');
// 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', 'press_release')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'press_release', 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' => [
'press_release' => [
'profiles' => 'automatic',
'fields' => [
'title' => 1,
'body' => 1,
'field_image' => [
'alt',
],
],
],
],
]);
}