You are here

public function ControllerTest::testLoggerReportsAccess in MongoDB 8.2

The access and contents of the admin/reports/mongodb/watchdog[/*] pages.

@todo verifyRowLimit(), verifyCron(), verifyEvents() as per DbLog.

File

modules/mongodb_watchdog/tests/src/Functional/ControllerTest.php, line 490

Class

ControllerTest
Test the MongoDB report controllers.

Namespace

Drupal\Tests\mongodb_watchdog\Functional

Code

public function testLoggerReportsAccess() {
  $expectations = [
    [
      $this->adminUser,
      Response::HTTP_OK,
    ],
    [
      $this->bigUser,
      Response::HTTP_OK,
    ],
    [
      $this->anyUser,
      Response::HTTP_FORBIDDEN,
    ],
  ];

  /** @var \Drupal\user\Entity\User $account */
  foreach ($expectations as $expectation) {
    [
      $account,
      $statusCode,
    ] = $expectation;
    $this
      ->drupalLogin($account);
    $this
      ->verifyReports($statusCode);
  }
}