public function PanelizerNodeFunctionalTest::_testPanelizerDefault in Panelizer 8.3
Tests rendering a node with Panelizer default.
File
- src/
Tests/ PanelizerNodeFunctionalTest.php, line 142
Class
- PanelizerNodeFunctionalTest
- Basic functional tests of using Panelizer with nodes.
Namespace
Drupal\Tests\panelizer\FunctionalCode
public function _testPanelizerDefault() {
$this
->panelize('page', NULL, [
'panelizer[custom]' => TRUE,
]);
/** @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' => 'middle',
]);
$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');
}