You are here

private function BackupMigratePermissionsTest::checkPaths in Backup and Migrate 5.0.x

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/BackupMigratePermissionsTest.php \Drupal\Tests\backup_migrate\Functional\BackupMigratePermissionsTest::checkPaths()

Check a set of paths to see if they are accessible.

Parameters

array $ok_paths: The paths that are expected return a 200 response, all others are expected to return a 403 response.

2 calls to BackupMigratePermissionsTest::checkPaths()
BackupMigratePermissionsTest::checkPathsWithUser in tests/src/Functional/BackupMigratePermissionsTest.php
Check a set of paths to see if they are accessible for a given permission.
BackupMigratePermissionsTest::testAnonymous in tests/src/Functional/BackupMigratePermissionsTest.php
Tests access for anonymous users.

File

tests/src/Functional/BackupMigratePermissionsTest.php, line 86

Class

BackupMigratePermissionsTest
Tests backup migrate permissions functionality.

Namespace

Drupal\Tests\backup_migrate\Functional

Code

private function checkPaths(array $ok_paths = []) {
  foreach ($this->allPaths as $path) {
    $this
      ->drupalGet($path);
    if (in_array($path, $ok_paths)) {
      $this
        ->assertSession()
        ->statusCodeEquals(200);
    }
    else {
      $this
        ->assertSession()
        ->statusCodeEquals(403);
    }
  }
}