You are here

public function PanelizerTermFunctionalTest::testPanelizerDefault in Panelizer 8.5

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/PanelizerTermFunctionalTest.php \Drupal\Tests\panelizer\Functional\PanelizerTermFunctionalTest::testPanelizerDefault()

Tests rendering a taxonomy term with Panelizer default.

File

tests/src/Functional/PanelizerTermFunctionalTest.php, line 261

Class

PanelizerTermFunctionalTest
Basic functional tests of using Panelizer with taxonomy terms.

Namespace

Drupal\Tests\panelizer\Functional

Code

public function testPanelizerDefault() {
  $assert_session = $this
    ->assertSession();

  /** @var \Drupal\panelizer\PanelizerInterface $panelizer */
  $panelizer = \Drupal::service('panelizer');
  $displays = $panelizer
    ->getDefaultPanelsDisplays('taxonomy_term', 'tags', 'full');
  $display = $displays['default'];
  $display
    ->addBlock([
    'id' => 'panelizer_test',
    'label' => 'Panelizer test',
    'provider' => 'block_content',
    'region' => 'content',
  ]);
  $panelizer
    ->setDefaultPanelsDisplay('default', 'taxonomy_term', 'tags', 'full', $display);

  // Create a term, and check that the IPE is visible on it.
  $term = $this
    ->createTerm();
  $out = $this
    ->drupalGet($term
    ->toUrl());
  $assert_session
    ->statusCodeEquals(200);
  $this
    ->verbose($out);
  $assert_session
    ->elementsCount('css', '#panels-ipe-content', 1);

  // Check that the block we added is visible.
  $assert_session
    ->pageTextContains('Panelizer test');
  $assert_session
    ->pageTextContains('Abracadabra');
}