getGuestRole() public méthode

Get the guest role (used when no identity is found)
public getGuestRole ( ) : string
Résultat string
 public function testSettersAndGetters()
 {
     $moduleOptions = new ModuleOptions(['identity_provider' => 'IdentityProvider', 'guest_role' => 'unknown', 'guards' => [], 'protection_policy' => 'deny', 'role_provider' => [], 'assertion_map' => ['foo' => 'bar'], 'unauthorized_strategy' => ['template' => 'error/unauthorized'], 'redirect_strategy' => ['redirect_to_route_connected' => 'home', 'redirect_to_route_disconnected' => 'login']]);
     $this->assertEquals('IdentityProvider', $moduleOptions->getIdentityProvider());
     $this->assertEquals('unknown', $moduleOptions->getGuestRole());
     $this->assertEquals([], $moduleOptions->getGuards());
     $this->assertEquals('deny', $moduleOptions->getProtectionPolicy());
     $this->assertEquals([], $moduleOptions->getRoleProvider());
     $this->assertEquals(['foo' => 'bar'], $moduleOptions->getAssertionMap());
     $this->assertInstanceOf('ZfcRbac\\Options\\UnauthorizedStrategyOptions', $moduleOptions->getUnauthorizedStrategy());
     $this->assertInstanceOf('ZfcRbac\\Options\\RedirectStrategyOptions', $moduleOptions->getRedirectStrategy());
 }
Exemple #2
0
 /**
  * Collect options
  *
  * @param  ModuleOptions $moduleOptions
  * @return void
  */
 private function collectOptions(ModuleOptions $moduleOptions)
 {
     $this->collectedOptions = ['guest_role' => $moduleOptions->getGuestRole(), 'protection_policy' => $moduleOptions->getProtectionPolicy()];
 }