You are here

public function ViewsUserOutputTest::testFieldOutput in Workbench Access 8

Tests field and filter.

File

tests/src/Functional/ViewsUserOutputTest.php, line 150

Class

ViewsUserOutputTest
Defines a class for testing workbench access views.

Namespace

Drupal\Tests\workbench_access\Functional

Code

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