Gc\Mvc\Listener\CacheListenerTest::testOnRouteWithCacheActivatedAndWithIdentityAndPreview PHP Метод

testOnRouteWithCacheActivatedAndWithIdentityAndPreview() публичный Метод

Test
    public function testOnRouteWithCacheActivatedAndWithIdentityAndPreview()
    {
        $config = Mockery::mock('Gc\\Core\\Config');
        $config->shouldReceive('getValue')->with('cache_is_active')->once()->andReturn(true);
        $identity = Mockery::mock('Zend\\Authentication\\AuthenticationService');
        $identity->shouldReceive('hasIdentity')->andReturn(true);
        $serviceLocator = Mockery::mock('Zend\\Mvc\\MvcEvent');
        $serviceLocator->shouldReceive('get')->once()->with('CoreConfig')->andReturn($config);
        $serviceLocator->shouldReceive('get')->once()->with('Auth')->andReturn($identity);
        $application = Mockery::Mock('Zend\\Mvc\\Application');
        $application->shouldReceive('getServiceManager')->once()->andReturn($serviceLocator);
        $p = new \Zend\Stdlib\Parameters(array('preview' => 'true'));
        $request = Mockery::mock('Zend\\Http\\PhpEnvironment\\Request');
        $request->shouldReceive('getQuery')->once()->andReturn($p);
        $event = Mockery::mock('Zend\\Mvc\\MvcEvent');
        $event->shouldReceive('getApplication')->once()->andReturn($application);
        $event->shouldReceive('getRequest')->once()->andReturn($request);
        $this->object->onRoute($event);
    }