You are here

public function ViewsOutputTest::testFieldOutput in Workbench Access 8

Tests field and filter.

File

tests/src/Functional/ViewsOutputTest.php, line 135

Class

ViewsOutputTest
Defines a class for testing workbench access views.

Namespace

Drupal\Tests\workbench_access\Functional

Code

public function testFieldOutput() {
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalGet('content-sections');
  $assert = $this
    ->assertSession();
  foreach ($this->terms as $section => $term) {
    $row = $assert
      ->elementExists('css', '.views-row:contains("' . $term
      ->label() . '")');
    $assert
      ->elementExists('css', '.views-row:contains("' . $section . ' node' . '")', $row);
    $this
      ->assertNoLinkByHref('/taxonomy/term/' . $term
      ->id());
  }
  $this
    ->drupalGet('content-sections-2');
  foreach ($this->terms as $section => $term) {
    $row = $assert
      ->elementExists('css', '.views-row:contains("' . $term
      ->label() . '")');
    $assert
      ->elementExists('css', '.views-row:contains("' . $section . ' node' . '")', $row);
    $this
      ->assertLinkByHref('/taxonomy/term/' . $term
      ->id());
  }
  $this
    ->drupalGet('content-sections-3');
  $assert = $this
    ->assertSession();
  foreach ($this->links as $section => $link) {
    $row = $assert
      ->elementExists('css', '.views-row:contains("' . $section . '")');
    $assert
      ->elementExists('css', '.views-row:contains("' . $section . ' node' . '")', $row);
    $this
      ->assertNoLink($section . ' node 1' . '-menu');
  }
  $this
    ->drupalGet('content-sections-4');
  foreach ($this->links as $section => $link) {
    $row = $assert
      ->elementExists('css', '.views-row:contains("' . $section . '")');
    $assert
      ->elementExists('css', '.views-row:contains("' . $section . ' node' . '")', $row);
    $this
      ->assertLink($section . ' node 1' . '-menu');
  }
}