You are here

public function CshsTest::testCshsViews in Client-side Hierarchical Select 8.3

Same name and namespace in other branches
  1. 8 tests/src/Functional/CshsTest.php \Drupal\Tests\cshs\Functional\CshsTest::testCshsViews()
  2. 8.2 tests/src/Functional/CshsTest.php \Drupal\Tests\cshs\Functional\CshsTest::testCshsViews()

Test views integration.

File

tests/src/Functional/CshsTest.php, line 35

Class

CshsTest
Tests the CSHS module.

Namespace

Drupal\Tests\cshs\Functional

Code

public function testCshsViews() : void {
  $user = $this
    ->drupalCreateUser([
    'access content',
  ]);
  $ct = $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);

  // Create a node to display by the view.
  $this
    ->drupalCreateNode([
    'uid' => $user
      ->id(),
    'type' => $ct
      ->id(),
    'status' => NodeInterface::PUBLISHED,
  ]);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('cshs');
  $assert = $this
    ->assertSession();
  $assert
    ->statusCodeEquals(200);
  $assert
    ->pageTextContains('CSHS view');
  $assert
    ->elementExists('css', '#edit-tid');
  $assert
    ->pageTextContains('Term ID');
  $assert
    ->elementExists('css', '#edit-tid-depth');
  $assert
    ->pageTextContains('Term ID (Depth)');
}