protected function PanelizerTestTrait::addPanelizerDefault in Panelizer 8.3
1 call to PanelizerTestTrait::addPanelizerDefault()
- PanelizerDefaultsTest::test in src/
Tests/ PanelizerDefaultsTest.php
File
- src/
Tests/ PanelizerTestTrait.php, line 67
Class
- PanelizerTestTrait
- Contains helper methods for writing functional tests of Panelizer.
Namespace
Drupal\panelizer\TestsCode
protected function addPanelizerDefault($node_type, $display = 'default') {
$label = $this
->getRandomGenerator()
->word(16);
$id = strtolower($label);
$default_id = "node__{$node_type}__{$display}__{$id}";
$options = [
'query' => [
'js' => 'nojs',
],
];
$this
->drupalGet("admin/structure/types/manage/{$node_type}/display");
$this
->assertResponse(200);
$this
->clickLink('Add a new Panelizer default display');
// Step 1: Enter the default's label and ID.
$edit = [
'id' => $id,
'label' => $label,
];
$this
->drupalPostForm(NULL, $edit, t('Next'));
$this
->assertResponse(200);
// Step 2: Define contexts.
$this
->assertUrl("admin/structure/panelizer/add/{$default_id}/contexts", $options);
$this
->drupalPostForm(NULL, [], t('Next'));
$this
->assertResponse(200);
// Step 3: Select layout.
$this
->assertUrl("admin/structure/panelizer/add/{$default_id}/layout", $options);
$this
->drupalPostForm(NULL, [], t('Next'));
$this
->assertResponse(200);
// Step 4: Select content.
$this
->assertUrl("admin/structure/panelizer/add/{$default_id}/content", $options);
$this
->drupalPostForm(NULL, [], t('Finish'));
$this
->assertResponse(200);
return $id;
}