Set the asset on the response, including headers and content.
public setAssetOnResponse ( Zend\Stdlib\ResponseInterface $response ) : Zend\Stdlib\ResponseInterface | ||
$response | Zend\Stdlib\ResponseInterface | |
return | Zend\Stdlib\ResponseInterface |
public function testClearOutputBufferInSetAssetOnResponse() { $this->expectOutputString(file_get_contents(__FILE__)); echo "This string would definately break any image source.\n"; echo "This one would make it even worse.\n"; echo "They all should be gone soon...\n"; $assetFilterManager = new AssetFilterManager(); $assetCacheManager = $this->getAssetCacheManagerMock(); $mimeResolver = new MimeResolver(); $assetManager = new AssetManager($this->getResolver(), array('clear_output_buffer' => true)); $assetFilterManager->setMimeResolver($mimeResolver); $assetManager->setAssetFilterManager($assetFilterManager); $assetManager->setAssetCacheManager($assetCacheManager); $assetManager->resolvesToAsset($this->getRequest()); $response = $assetManager->setAssetOnResponse(new Response()); echo $response->getContent(); }
/** * @expectedException \AssetManager\Exception\RuntimeException */ public function testSetAssetOnReponseFailsWhenNotResolved() { $resolver = $this->getMock('AssetManager\\Resolver\\ResolverInterface'); $assetManager = new AssetManager($resolver); $assetManager->setAssetOnResponse(new Response()); }