FrontPageTest.php in Page Manager 8
File
src/Tests/FrontPageTest.php
View source
<?php
namespace Drupal\page_manager\Tests;
use Drupal\block\Entity\Block;
use Drupal\page_manager\Entity\Page;
use Drupal\page_manager\Entity\PageVariant;
use Drupal\simpletest\WebTestBase;
class FrontPageTest extends WebTestBase {
use PageTestHelperTrait;
public static $modules = [
'page_manager',
'block',
];
public function testFrontPageTitle() {
$page = Page::create([
'label' => 'My frontpage',
'id' => 'myfront',
'path' => '/myfront',
]);
$page
->save();
$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();
$this
->drupalGet('');
$this
->assertTitle('Home | Drupal');
}
}