You can look at OcraCachedViewResolver's tests for that :)
On 16 Jun 2013 13:00, "Christian Bergau" <notifications@github.com> wrote:

> In src/BjyAuthorize/Service/Authorize.php:
>
> >
> > -        foreach ($this->serviceLocator->get('BjyAuthorize\RoleProviders') as $provider) {
> > -            $this->addRoleProvider($provider);
> > +        if ($this->useCache()) {
> > +            $this->acl = $this->cache->getItem($this->getCacheKey());
>
> How to unit test this? Im trying to write test for that. I tried it with
> returnCallback to manipulate $success but i cant get it to work. The code
> is finished but i do stuck with that one test.
>
> So the code is:
>
> $cache      = $this->serviceLocator->get('BjyAuthorize\Cache');
>     $success    = false;
>     $this->acl  = $cache->getItem($this->config['cache_key'], $success);
>
>
>     if (!($this->acl instanceof Acl) || !$success) {
>         $this->loadAcl();
>         $cache->setItem($this->config['cache_key'], $this->acl);
>     }
>
> How to write a test for that? I need to manipulate $success, so that its
> value is true.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/bjyoungblood/BjyAuthorize/pull/145/files#r4715876>
> .
>