You are here

public function ModerationDashboardPermissionTest::testCanViewOwnDashboard 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::testCanViewOwnDashboard()

Tests if a user can view their dashboard with permission.

File

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

Class

ModerationDashboardPermissionTest
Tests moderation dashboard permissions.

Namespace

Drupal\Tests\moderation_dashboard\Functional

Code

public function testCanViewOwnDashboard() {
  foreach ($this->canViewOwnDashboardCases as $i => $testCase) {
    $user = $this
      ->createUser($testCase['permissions']);
    $this
      ->drupalLogin($user);
    $this
      ->assertSession()
      ->addressEquals("/user/{$user->id()}/moderation/dashboard");
    $status_code = $this
      ->getSession()
      ->getStatusCode();
    $message = "#{$i}: expected 200, got {$status_code}.";
    $this
      ->assertEquals(200, $status_code, $message);
  }
}