You are here

public function PanelizerAddDefaultLinkTest::test in Panelizer 8.5

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/PanelizerAddDefaultLinkTest.php \Drupal\Tests\panelizer\Functional\PanelizerAddDefaultLinkTest::test()

Confirm a content type can be panelized and unpanelized.

File

tests/src/Functional/PanelizerAddDefaultLinkTest.php, line 32

Class

PanelizerAddDefaultLinkTest
@group panelizer

Namespace

Drupal\Tests\panelizer\Functional

Code

public function test() {
  $assert_session = $this
    ->assertSession();

  // Place the local actions block in the theme so that we can assert the
  // presence of local actions and such.
  $this
    ->drupalPlaceBlock('local_actions_block', [
    'region' => 'content',
    'theme' => \Drupal::theme()
      ->getActiveTheme()
      ->getName(),
  ]);
  $content_type = 'page';

  // Log in the user.
  $this
    ->loginUser1();

  // Create the content type.
  $this
    ->drupalCreateContentType([
    'type' => $content_type,
    'name' => 'Page',
  ]);
  $this->container
    ->get('panelizer')
    ->setPanelizerSettings('node', 'page', 'default', [
    'enable' => TRUE,
    'allow' => FALSE,
    'custom' => FALSE,
    'default' => 'default',
  ]);
  $this
    ->drupalGet('/admin/structure/types/manage/page/display');

  // Confirm that the content type is now panelized.
  $assert_session
    ->linkNotExists('Add a new Panelizer default display');

  // Un-panelize the content type.
  $this
    ->unpanelize($content_type);

  // Confirm that the content type is no longer panelized.
  $assert_session
    ->linkNotExists('Add a new Panelizer default display');
}