public function PanelizerIpeTest::testAdminUser in Panelizer 8.3
Test that the IPE functionality as user 1, which should cover all options.
File
- src/
Tests/ PanelizerIpeTest.php, line 83
Class
- PanelizerIpeTest
- Confirm that the IPE functionality works.
Namespace
Drupal\panelizer\TestsCode
public function testAdminUser() {
$this
->setupContentType();
// Create a test node.
$node = $this
->createTestNode();
// Log in as user 1.
$this
->loginUser1();
// Load the test node.
$this
->drupalGet('node/' . $node
->id());
$this
->assertResponse(200);
// Confirm the JSON Drupal settings are appropriate.
$drupalSettings = NULL;
$matches = [];
if (preg_match('@<script type="application/json" data-drupal-selector="drupal-settings-json">([^<]*)</script>@', $this->content, $matches)) {
$drupalSettings = Json::decode($matches[1]);
$this
->verbose('<pre>' . print_r($drupalSettings, TRUE) . '</pre>');
}
$this
->assertNotNull($drupalSettings);
if (!empty($drupalSettings)) {
$this
->assertTrue(isset($drupalSettings['panels_ipe']));
$this
->assertTrue(isset($drupalSettings['panels_ipe']['regions']));
$this
->assertTrue(isset($drupalSettings['panels_ipe']['layout']));
$this
->assertTrue(isset($drupalSettings['panels_ipe']['user_permission']));
$this
->assertTrue(isset($drupalSettings['panels_ipe']['panels_display']));
$this
->assertTrue(isset($drupalSettings['panels_ipe']['unsaved']));
$this
->assertTrue(isset($drupalSettings['panelizer']));
$this
->assertTrue(isset($drupalSettings['panelizer']['entity']));
$this
->assertTrue(isset($drupalSettings['panelizer']['entity']['entity_type_id']));
$this
->assertEqual($drupalSettings['panelizer']['entity']['entity_type_id'], 'node');
$this
->assertTrue(isset($drupalSettings['panelizer']['entity']['entity_id']));
$this
->assertEqual($drupalSettings['panelizer']['entity']['entity_id'], $node
->id());
$this
->assertTrue(isset($drupalSettings['panelizer']['user_permission']));
$this
->assertTrue(isset($drupalSettings['panelizer']['user_permission']['revert']));
$this
->assertTrue(isset($drupalSettings['panelizer']['user_permission']['save_default']));
}
}