You are here

public function RateNodeWidgetTestBase::testPermissions in Rate 8

Tests voting permissions.

File

tests/src/Functional/RateNodeWidgetTestBase.php, line 95

Class

RateNodeWidgetTestBase
Base class for Rate functional tests.

Namespace

Drupal\Tests\rate\Functional

Code

public function testPermissions() {
  $this
    ->drupalLogin($this->users[0]);
  $this
    ->drupalGet('node/1');
  foreach ($this->labels as $label) {
    $this
      ->assertSession()
      ->linkExists($label);
  }

  // Create a user without voting permissions.
  $user = $this
    ->createUser([
    'access content',
  ]);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('node/1');
  foreach (array_merge($this->labels, [
    'Undo',
  ]) as $label) {
    $this
      ->assertSession()
      ->linkNotExists($label);
  }
}