public function DisplayVariantOverrideTest::testSiteTemplateAndPanelsCanBeRenderedOnTheSamePage in Panels Everywhere 8.4
Verify that site_template & panels can be rendered on the same page.
File
- tests/
src/ Functional/ DisplayVariantOverrideTest.php, line 98
Class
- DisplayVariantOverrideTest
- Make sure the route override behaviour works as intended.
Namespace
Drupal\Tests\panels_everywhere\FunctionalCode
public function testSiteTemplateAndPanelsCanBeRenderedOnTheSamePage() {
// set up panels everywhere
$site_template = $this->pageStorage
->load('site_template');
$site_template
->setStatus(TRUE);
$site_template
->save();
$panelsEverywhereVariant = $site_template
->getVariant('panels_everywhere');
$this
->placeBlockOnVariant($panelsEverywhereVariant, 'system_main_block', 'content');
$this
->placeBlockOnVariant($panelsEverywhereVariant, 'system_powered_by_block', 'content');
$panelsEverywhereVariant
->save();
// set up panels
$node_view = $this->pageStorage
->load('node_view');
$panelsVariant = $this->pageVariantStorage
->create([
'id' => 'this-is-a-panels-variant',
'variant' => 'panels_variant',
'variant_settings' => [
'id' => 'panels_variant',
'layout' => 'layout_onecol',
'builder' => 'standard',
],
]);
$panelsVariant
->setPageEntity($node_view);
$this
->placeBlockOnVariant($panelsVariant, 'entity_view:node', 'content', [
'view_mode' => 'full',
'context_mapping' => [
'entity' => 'node',
],
]);
$this
->placeBlockOnVariant($panelsVariant, 'views_block:who_s_new-block_1', 'content', [
'label_display' => 'visible',
'items_per_page' => 'none',
]);
$panelsVariant
->save();
// @todo: Remove once cache info is setup correctly
drupal_flush_all_caches();
$this
->drupalGet('node/' . $this->node
->id());
$this
->assertSession()
->pageTextContains('Powered by');
$this
->assertSession()
->pageTextContains($this->node->body->value);
$this
->assertSession()
->pageTextContains("Who's new");
}