public function FrontPageTest::testFrontPageTitle in Page Manager 8.4
Tests the front page title.
File
- tests/
src/ Functional/ FrontPageTest.php, line 34
Class
- FrontPageTest
- Tests a page manager page as front page.
Namespace
Drupal\Tests\page_manager\FunctionalCode
public function testFrontPageTitle() {
// Use a block page for frontpage.
$page = Page::create([
'label' => 'My frontpage',
'id' => 'myfront',
'path' => '/myfront',
]);
$page
->save();
/** @var \Drupal\page_manager\PageVariantInterface $page_variant */
$page_variant = PageVariant::create([
'variant' => 'block_display',
'id' => 'block_page',
'label' => 'Block page',
'page' => 'myfront',
]);
$page_variant
->save();
$this
->config('system.site')
->set('page.front', '/myfront')
->save();
$block = Block::create([
'id' => $this
->randomMachineName(),
'plugin' => 'system_powered_by_block',
]);
$block
->save();
$page_variant
->getVariantPlugin()
->setConfiguration([
'page_title' => '',
'blocks' => [
$block
->uuid() => [
'region' => 'top',
'weight' => 0,
'id' => $block
->id(),
'uuid' => $block
->uuid(),
'context_mapping' => [],
],
],
]);
$this
->verbose(var_export($page_variant
->toArray(), TRUE));
$this
->triggerRouterRebuild();
// The title should default to "Home" on the front page.
// @todo This gives 404 :(
$this
->drupalGet('');
$this
->assertTitle('Home | Drupal');
}