You are here

HiddenRegionTest.php in Display Suite 8.4

Same filename and directory in other branches
  1. 8.3 tests/src/Functional/HiddenRegionTest.php

File

tests/src/Functional/HiddenRegionTest.php
View source
<?php

namespace Drupal\Tests\ds\Functional;


/**
 * Tests for testing the hidden region option.
 *
 * @group ds
 */
class HiddenRegionTest extends TestBase {

  /**
   * Tests hidden region functionality.
   */
  public function testHiddenRegion() {

    // Enable the hidden region option.
    $edit = [
      'fs3[hidden_region]' => TRUE,
    ];
    $this
      ->drupalGet('admin/structure/ds/settings');
    $this
      ->submitForm($edit, 'Save configuration');
    $this
      ->dsSelectLayout();

    // Create a node.
    $settings = [
      'type' => 'article',
    ];
    $node = $this
      ->drupalCreateNode($settings);

    // Configure fields.
    $fields = [
      'fields[body][region]' => 'right',
      'fields[test_field][region]' => 'ds_hidden',
    ];
    $this
      ->dsConfigureUi($fields);

    // Test field not printed.
    $this
      ->drupalGet('node/' . $node
      ->id());
    $this
      ->assertSession()
      ->pageTextNotContains('Test field plugin on node ' . $node
      ->id());

    // Configure fields.
    $fields = [
      'fields[body][region]' => 'right',
      'fields[test_field][region]' => 'right',
    ];
    $this
      ->dsConfigureUi($fields);

    // Test field printed.
    $this
      ->drupalGet('node/' . $node
      ->id());
    $this
      ->assertSession()
      ->pageTextContains('Test field plugin on node ' . $node
      ->id());
  }

}

Classes

Namesort descending Description
HiddenRegionTest Tests for testing the hidden region option.