protected function FreelinkingMultilingualTest::setUp in Freelinking 4.0.x
Same name and namespace in other branches
- 8.3 tests/src/Functional/FreelinkingMultilingualTest.php \Drupal\Tests\freelinking\Functional\FreelinkingMultilingualTest::setUp()
Throws
\Drupal\Core\Entity\EntityStorageException
\Behat\Mink\Exception\ExpectationException
Overrides FreelinkingBrowserTestBase::setUp
File
- tests/
src/ Functional/ FreelinkingMultilingualTest.php, line 41
Class
- FreelinkingMultilingualTest
- Tests that multilingual capabilities of Freelinking.
Namespace
Drupal\Tests\freelinking\FunctionalCode
protected function setUp() : void {
parent::setUp();
$this
->updateFilterSettings();
// Add a new language.
ConfigurableLanguage::createFromLangcode('es')
->save();
// Create a user to administer languages.
$this->adminUser = $this
->drupalCreateUser([
'access administration pages',
'access content',
'administer content types',
'administer filters',
'administer languages',
'administer content translation',
'access user profiles',
'create page content',
'create content translations',
'edit own page content',
'update content translations',
'translate any entity',
]);
$this
->drupalLogin($this->adminUser);
// Enable URL and User language detection and selection.
$edit = [
'language_interface[enabled][language-url]' => '1',
'language_interface[enabled][language-user]' => '1',
];
$this
->drupalGet('admin/config/regional/language/detection');
$this
->submitForm($edit, 'Save settings');
// Enable multilingual support for "Basic page" content type.
$edit = [
'language_configuration[language_alterable]' => TRUE,
'language_configuration[content_translation]' => TRUE,
];
$this
->drupalGet('admin/structure/types/manage/page');
$this
->submitForm($edit, 'Save content type');
$this
->assertSession()
->pageTextContains('The content type Basic page has been updated.');
// Create a node translation.
$edit = [
'title[0][value]' => 'Primera página',
'body[0][value]' => 'Contenido traducido.',
];
$this
->drupalGet('node/1/translations/add/en/es');
$this
->submitForm($edit, 'Save');
}