You are here

public function PanelizerIpeTest::testAdministerEntityContent in Panelizer 8.3

@todo Confirm the 'administer panelizer $entity_type_id $bundle content' permission works.

File

src/Tests/PanelizerIpeTest.php, line 189

Class

PanelizerIpeTest
Confirm that the IPE functionality works.

Namespace

Drupal\panelizer\Tests

Code

public function testAdministerEntityContent() {
  $this
    ->setupContentType();

  // Need the node for the tests below, so create it now.
  $node = $this
    ->createTestNode();
  $perms = [
    'administer panelizer node page content',
  ];
  $drupalSettings = $this
    ->setupPermissionTests($perms, $node);
  $this
    ->assertNotNull($drupalSettings);

  // @todo How to tell if the user can change the display or add new items vs
  // other tasks?
  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']));
  }
}