You are here

public function PanelizerIntegrationTest::testUserEditSession in Panelizer 8.5

Same name and namespace in other branches
  1. 8.4 tests/src/FunctionalJavascript/PanelizerIntegrationTest.php \Drupal\Tests\panelizer\FunctionalJavascript\PanelizerIntegrationTest::testUserEditSession()

Tests that the IPE editing session is specific to a user.

File

tests/src/FunctionalJavascript/PanelizerIntegrationTest.php, line 77

Class

PanelizerIntegrationTest
Tests the JavaScript functionality of Panels IPE with Panelizer.

Namespace

Drupal\Tests\panelizer\FunctionalJavascript

Code

public function testUserEditSession() {
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalGet('/node/1');
  $this
    ->assertIPELoaded();
  $assert_session
    ->elementExists('css', '.layout--onecol');

  // Change the layout to lock the IPE.
  $this
    ->changeLayout('Columns: 2', 'layout_twocol');
  $assert_session
    ->elementExists('css', '.layout--twocol');
  $assert_session
    ->elementNotExists('css', '.layout--onecol');

  // Create a second node.
  $this
    ->drupalGet('node/add/page');
  $this
    ->submitForm([
    'title[0][value]' => 'Test Node 2',
  ], t('Save'));

  // Ensure the second node does not use the session of the other node.
  $this
    ->drupalGet('/node/2');
  $assert_session
    ->elementExists('css', '.layout--onecol');
  $assert_session
    ->elementNotExists('css', '.layout--twocol');
}