You are here

public function RateJavascriptNodeWidgetTestBase::testPermissions in Rate 8

Tests voting permissions.

File

tests/src/FunctionalJavascript/RateJavascriptNodeWidgetTestBase.php, line 95

Class

RateJavascriptNodeWidgetTestBase
Base class for Rate Javascript functional tests.

Namespace

Drupal\Tests\rate\FunctionalJavascript

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);
  }
}