protected function PanelizerTestTrait::panelize in Panelizer 8.5
Same name and namespace in other branches
- 8.4 tests/src/Functional/PanelizerTestTrait.php \Drupal\Tests\panelizer\Functional\PanelizerTestTrait::panelize()
Panelizes a node type's default view display.
Parameters
string $content_type: The content type, i.e. the node bundle ID, to configure; defaults to 'page'.
string $display: (optional) The view mode to work on.
array $values: (optional) Additional form values.
1 call to PanelizerTestTrait::panelize()
- PanelizerTestTrait::setupContentType in tests/
src/ Functional/ PanelizerTestTrait.php - Prep a content type for use with these tests.
File
- tests/
src/ Functional/ PanelizerTestTrait.php, line 76
Class
- PanelizerTestTrait
- Contains helper methods for writing functional tests of Panelizer.
Namespace
Drupal\Tests\panelizer\FunctionalCode
protected function panelize($content_type = 'page', $display = NULL, array $values = []) {
$this
->drupalGet("admin/structure/types");
$this
->assertResponse(200);
$this
->drupalGet("admin/structure/types/manage/{$content_type}");
$this
->assertResponse(200);
$path = "admin/structure/types/manage/{$content_type}/display";
if (!empty($display)) {
$path .= '/' . $display;
}
$this
->drupalGet($path);
$this
->assertResponse(200);
$edit = [
'panelizer[enable]' => TRUE,
] + $values;
$this
->submitForm($edit, 'Save');
$this
->assertResponse(200);
\Drupal::service('entity_display.repository')
->getFormDisplay('node', $content_type)
->setComponent('panelizer', [
'type' => 'panelizer',
])
->save();
}