You are here

public function OgMenuAccessTest::testUnsupportedOperation in Organic Groups Menu (OG Menu) 8

Tests that unsupported operations do not grant access.

File

tests/src/Kernel/OgMenuAccessTest.php, line 271

Class

OgMenuAccessTest
Tests access to operations on OG Menu instances.

Namespace

Drupal\Tests\og_menu\Kernel

Code

public function testUnsupportedOperation() {

  // In the context of a group UID1 and the OG admin are 'superadmins' which
  // have access to everything, even to unsupported operations.
  $user_keys = [
    'uid1' => TRUE,
    'ogadmin' => TRUE,
    'ogmenuadmin' => FALSE,
    'groupadmin' => FALSE,
    'groupmember' => FALSE,
    'authenticated' => FALSE,
  ];
  foreach ($user_keys as $user_key => $expected_access) {
    $message = "User {$user_key} should " . ($expected_access ? '' : 'not') . " be granted access to an unsupported operation by default.";
    $this
      ->assertEquals($expected_access, $this->ogMenuInstance
      ->access('some-non-existing-operation', $this->users[$user_key]), $message);
  }
}