You are here

public function DisplayVariantOverrideTest::testDisabledRouteOverrideForNodeViewWithPanelsVariantPresentWillCausesNodeToBeRendered in Panels Everywhere 8.4

Verify that disabled overrides work will allow panels to render node.

File

tests/src/Functional/DisplayVariantOverrideTest.php, line 206

Class

DisplayVariantOverrideTest
Make sure the route override behaviour works as intended.

Namespace

Drupal\Tests\panels_everywhere\Functional

Code

public function testDisabledRouteOverrideForNodeViewWithPanelsVariantPresentWillCausesNodeToBeRendered() {
  $page = $this->pageStorage
    ->load('node_view');

  // set up panels everywhere
  $panelsEverywhereVariant = $this->pageVariantStorage
    ->create([
    'id' => 'this-is-a-panels_everywhere-variant',
    'variant' => 'panels_everywhere_variant',
    'variant_settings' => [
      'id' => 'panels_everywhere_variant',
      'layout' => 'layout_onecol',
      'builder' => 'standard',
      'route_override_enabled' => FALSE,
    ],
  ]);
  $panelsEverywhereVariant
    ->setPageEntity($page);
  $this
    ->placeBlockOnVariant($panelsEverywhereVariant, 'system_main_block', 'content');
  $this
    ->placeBlockOnVariant($panelsEverywhereVariant, 'system_powered_by_block', 'content');
  $panelsEverywhereVariant
    ->save();

  // set up panels
  $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($page);
  $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");
}