예제 #1
0
 function it_checks_if_permission_is_in_the_cached_array($cache, RoleInterface $role)
 {
     $role->getCode()->shouldBeCalled()->willReturn('catalog_manager');
     $cache->contains('rbac_role:catalog_manager')->shouldBeCalled()->willReturn(true);
     $cache->fetch('rbac_role:catalog_manager')->shouldBeCalled()->willReturn(['can_eat_bananas', 'can_smash_bananas']);
     $this->hasPermission($role, 'can_eat_bananas')->shouldReturn(true);
     $this->hasPermission($role, 'can_eat_oranges')->shouldReturn(false);
 }
예제 #2
0
 /**
  * @param RoleInterface $role
  *
  * @return string
  */
 private function getCacheKey(RoleInterface $role)
 {
     return self::CACHE_KEY_PREFIX . $role->getCode();
 }
예제 #3
0
 /**
  * @param RoleInterface $role
  *
  * @return string
  */
 private function getCacheKey(RoleInterface $role)
 {
     return $role->getCode();
 }