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); }
/** * @param RoleInterface $role * * @return string */ private function getCacheKey(RoleInterface $role) { return self::CACHE_KEY_PREFIX . $role->getCode(); }
/** * @param RoleInterface $role * * @return string */ private function getCacheKey(RoleInterface $role) { return $role->getCode(); }