function LanguageSwitchingTest::createHomePage
Same name in other branches
- 10 core/modules/language/tests/src/Functional/LanguageSwitchingTest.php \Drupal\Tests\language\Functional\LanguageSwitchingTest::createHomePage()
Create a node and set it as the home pages.
1 call to LanguageSwitchingTest::createHomePage()
- LanguageSwitchingTest::doTestHomePageLinks in core/
modules/ language/ tests/ src/ Functional/ LanguageSwitchingTest.php - The home page link should be "/" or "/{language_prefix}".
File
-
core/
modules/ language/ tests/ src/ Functional/ LanguageSwitchingTest.php, line 704
Class
- LanguageSwitchingTest
- Functional tests for the language switching feature.
Namespace
Drupal\Tests\language\FunctionalCode
protected function createHomePage() : void {
$entity_type_manager = \Drupal::entityTypeManager();
// Create a node type and make it translatable.
$entity_type_manager->getStorage('node_type')
->create([
'type' => 'page',
'name' => 'Page',
])
->save();
// Create a published node.
$node = $entity_type_manager->getStorage('node')
->create([
'type' => 'page',
'title' => $this->randomMachineName(),
'status' => 1,
]);
$node->save();
// Change the front page to /node/1.
$edit = [
'site_frontpage' => '/node/1',
];
$this->drupalGet('admin/config/system/site-information');
$this->submitForm($edit, 'Save configuration');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.