public function PanelizerNodeFunctionalTest::testPanelizerDefault in Panelizer 8.5
Same name and namespace in other branches
- 8.4 tests/src/Functional/PanelizerNodeFunctionalTest.php \Drupal\Tests\panelizer\Functional\PanelizerNodeFunctionalTest::testPanelizerDefault()
Tests rendering a node with Panelizer default.
File
- tests/
src/ Functional/ PanelizerNodeFunctionalTest.php, line 441
Class
- PanelizerNodeFunctionalTest
- Basic functional tests of using Panelizer with nodes.
Namespace
Drupal\Tests\panelizer\FunctionalCode
public function testPanelizerDefault() {
/** @var \Drupal\panelizer\PanelizerInterface $panelizer */
$panelizer = $this->container
->get('panelizer');
$displays = $panelizer
->getDefaultPanelsDisplays('node', 'page', 'default');
$display = $displays['default'];
$display
->addBlock([
'id' => 'panelizer_test',
'label' => 'Panelizer test',
'provider' => 'block_content',
'region' => 'content',
]);
$panelizer
->setDefaultPanelsDisplay('default', 'node', 'page', 'default', $display);
// Create a node, and check that the IPE is visible on it.
$node = $this
->drupalCreateNode([
'type' => 'page',
]);
$out = $this
->drupalGet('node/' . $node
->id());
$this
->assertResponse(200);
$this
->verbose($out);
$elements = $this
->xpath('//*[@id="panels-ipe-content"]');
if (is_array($elements)) {
$this
->assertIdentical(count($elements), 1);
}
else {
$this
->fail('Could not parse page content.');
}
// Check that the block we added is visible.
$this
->assertText('Panelizer test');
$this
->assertText('Abracadabra');
}