You are here

public function ModerationDashboardPermissionTest::testCanViewOtherDashboard in Moderation Dashboard 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/ModerationDashboardPermissionTest.php \Drupal\Tests\moderation_dashboard\Functional\ModerationDashboardPermissionTest::testCanViewOtherDashboard()

Tests if a user can view other dashboards with permission.

File

tests/src/Functional/ModerationDashboardPermissionTest.php, line 127

Class

ModerationDashboardPermissionTest
Tests moderation dashboard permissions.

Namespace

Drupal\Tests\moderation_dashboard\Functional

Code

public function testCanViewOtherDashboard() {
  foreach ($this->canViewOtherDashboardCases as $i => $testCase) {
    $user_a = $this
      ->createUser($testCase['permissions_a']);
    $user_b = $this
      ->createUser($testCase['permissions_b']);
    $this
      ->drupalLogin($user_a);
    $this
      ->drupalGet("/user/{$user_b->id()}/moderation/dashboard");
    $status_code = $this
      ->getSession()
      ->getStatusCode();
    $message = "#{$i}: expected 200, got {$status_code}.";
    $this
      ->assertEquals(200, $status_code, $message);
  }
}