protected function LingotekNodeBulkFormWithGroupModuleTest::setUp in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
- 3.0.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
- 3.1.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
- 3.2.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
- 3.3.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
- 3.4.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
- 3.5.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
- 3.6.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
- 3.8.x tests/src/Functional/Form/LingotekNodeBulkFormWithGroupModuleTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormWithGroupModuleTest::setUp()
Overrides LingotekTestBase::setUp
File
- tests/
src/ Functional/ Form/ LingotekNodeBulkFormWithGroupModuleTest.php, line 48
Class
- LingotekNodeBulkFormWithGroupModuleTest
- Tests the bulk management form when the group module is enabled.
Namespace
Drupal\Tests\lingotek\Functional\FormCode
protected function setUp() : void {
parent::setUp();
// Place the actions and title block.
$this
->drupalPlaceBlock('page_title_block', [
'region' => 'content',
'weight' => -5,
]);
$this
->drupalPlaceBlock('local_tasks_block', [
'region' => 'content',
'weight' => -10,
]);
$this
->drupalPlaceBlock('local_actions_block', [
'region' => 'content',
'weight' => -2,
]);
$type = NodeType::load('article');
$field = node_add_body_field($type);
// Assign display settings for the 'default' and 'teaser' view modes.
$entity_form_display = EntityFormDisplay::load('node' . '.' . $type
->id() . '.' . 'default');
if (!$entity_form_display) {
$entity_form_display = EntityFormDisplay::create([
'targetEntityType' => 'node',
'bundle' => $type
->id(),
'mode' => 'default',
'status' => TRUE,
]);
}
$entity_form_display
->setComponent('body', [
'type' => 'text_textarea_with_summary',
])
->save();
$display = EntityViewDisplay::load('node' . '.' . $type
->id() . '.' . 'default');
if (!$display) {
$display = EntityViewDisplay::create([
'targetEntityType' => 'node',
'bundle' => $type
->id(),
'mode' => 'default',
'status' => TRUE,
]);
}
$display
->setComponent('body', [
'label' => 'hidden',
'type' => 'text_default',
])
->save();
$this
->drupalGet('/admin/structure/types/manage/article/form-display');
// 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();
$this
->saveLingotekContentTranslationSettingsForNodeTypes();
$this
->configureGroups();
}