AssetManagerTest\ModuleTest::testOnDispatchStatus200 PHP Method

testOnDispatchStatus200() public method

    public function testOnDispatchStatus200()
    {
        $resolver = $this->getMock(ResolverInterface::class);
        $assetManager = $this->getMock(AssetManager::class, array('resolvesToAsset', 'setAssetOnResponse'), array($resolver));
        $assetManager->expects($this->once())->method('resolvesToAsset')->will($this->returnValue(true));
        $amResponse = new Response();
        $amResponse->setContent('bacon');
        $assetManager->expects($this->once())->method('setAssetOnResponse')->will($this->returnValue($amResponse));
        $serviceManager = $this->getMock(ServiceLocatorInterface::class);
        $serviceManager->expects($this->any())->method('get')->will($this->returnValue($assetManager));
        $application = $this->getMock(ApplicationInterface::class);
        $application->expects($this->once())->method('getServiceManager')->will($this->returnValue($serviceManager));
        $event = new MvcEvent();
        $response = new Response();
        $request = new Request();
        $module = new Module();
        $event->setApplication($application);
        $response->setStatusCode(404);
        $event->setResponse($response);
        $event->setRequest($request);
        $return = $module->onDispatch($event);
        $this->assertEquals(200, $return->getStatusCode());
    }