You are here

public function ViewModeTest::testCustomization in Lightning Layout 8

Tests that the Panelizer widget respects view mode customization settings.

File

tests/src/Functional/ViewModeTest.php, line 94

Class

ViewModeTest
@group lightning_layout

Namespace

Drupal\Tests\lightning_layout\Functional

Code

public function testCustomization() {
  $assert_session = $this
    ->assertSession();
  $display = lightning_layout_entity_get_display('node', 'landing_page', 'search_result')
    ->setStatus(TRUE)
    ->setThirdPartySetting('panelizer', 'enable', TRUE)
    ->setThirdPartySetting('panelizer', 'custom', TRUE)
    ->setThirdPartySetting('panelizer', 'allow', TRUE);
  $this
    ->assertSame(SAVED_NEW, $display
    ->save());
  $account = $this
    ->drupalCreateUser([
    'create landing_page content',
  ]);
  $this
    ->drupalLogin($account);
  $this
    ->drupalGet('/node/add/landing_page');
  $assert_session
    ->fieldExists('Full content');
  $assert_session
    ->fieldExists('Search result highlighting input');
  $this
    ->assertSame(SAVED_UPDATED, $display
    ->setStatus(FALSE)
    ->save());
  $this
    ->getSession()
    ->reload();
  $assert_session
    ->fieldExists('Full content');
  $assert_session
    ->fieldNotExists('Search result highlighting input');
}