protected function PanelizerIpeTest::setupPermissionTests in Panelizer 8.4
Same name and namespace in other branches
- 8.5 tests/src/Functional/PanelizerIpeTest.php \Drupal\Tests\panelizer\Functional\PanelizerIpeTest::setupPermissionTests()
Do the necessary setup work for the individual permissions tests.
Parameters
array $perms: Any additiona permissions that need to be added.
obj $node: The node to test against, if none provided one will be generated.
Return value
array The full drupalSettings JSON structure in array format.
3 calls to PanelizerIpeTest::setupPermissionTests()
- PanelizerIpeTest::testAdministerEntityContentPermission in tests/
src/ Functional/ PanelizerIpeTest.php - @todo Confirm the 'administer panelizer $entity_type_id $bundle content' permission works.
- PanelizerIpeTest::testAdministerEntityLayoutPermission in tests/
src/ Functional/ PanelizerIpeTest.php - @todo Confirm the 'administer panelizer $entity_type_id $bundle layout' permission works.
- PanelizerIpeTest::testAdministerEntityRevertPermission in tests/
src/ Functional/ PanelizerIpeTest.php - @todo Confirm the 'administer panelizer $entity_type_id $bundle revert' permission works.
File
- tests/
src/ Functional/ PanelizerIpeTest.php, line 359
Class
- PanelizerIpeTest
- Confirm that the IPE functionality works.
Namespace
Drupal\Tests\panelizer\FunctionalCode
protected function setupPermissionTests(array $perms, $node = NULL) {
// Create a new user with the permissions being tested.
$account = $this
->createAdminUser($perms);
$this
->drupalLogin($account);
// Make sure there's a test node to work with.
if (empty($node)) {
$node = $this
->createTestNode();
}
// Load the test node.
$this
->drupalGet('node/' . $node
->id());
$this
->assertResponse(200);
// Extract the drupalSettings structure and return it.
$drupalSettings = NULL;
$matches = [];
if (preg_match('@<script type="application/json" data-drupal-selector="drupal-settings-json">([^<]*)</script>@', $this
->getRawContent(), $matches)) {
$drupalSettings = Json::decode($matches[1]);
$this
->verbose('<pre>' . print_r($drupalSettings, TRUE) . '</pre>');
}
return $drupalSettings;
}