setAssetFilterManager() 공개 메소드

Set the AssetFilterManager.
public setAssetFilterManager ( AssetManager\Service\AssetFilterManager $filterManager )
$filterManager AssetManager\Service\AssetFilterManager
 /**
  * @inheritDoc
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $config = $container->get('config');
     $assetManagerConfig = array();
     if (!empty($config['asset_manager'])) {
         $assetManagerConfig = $config['asset_manager'];
     }
     $assetManager = new AssetManager($container->get(AggregateResolver::class), $assetManagerConfig);
     $assetManager->setAssetFilterManager($container->get(AssetFilterManager::class));
     $assetManager->setAssetCacheManager($container->get(AssetCacheManager::class));
     return $assetManager;
 }
 /**
  * {@inheritDoc}
  *
  * @return AssetManager
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config');
     $assetManagerConfig = array();
     if (!empty($config['asset_manager'])) {
         $assetManagerConfig = $config['asset_manager'];
     }
     $assetManager = new AssetManager($serviceLocator->get('AssetManager\\Service\\AggregateResolver'), $assetManagerConfig);
     $assetManager->setAssetFilterManager($serviceLocator->get('AssetManager\\Service\\AssetFilterManager'));
     $assetManager->setAssetCacheManager($serviceLocator->get('AssetManager\\Service\\AssetCacheManager'));
     return $assetManager;
 }
 public function setUp()
 {
     require_once __DIR__ . '/../../_files/JSMin.inc';
     $config = array('filters' => array(self::$assetName => array(array('filter' => 'JSMin'))));
     $assetFilterManager = new AssetFilterManager($config['filters']);
     $assetCacheManager = $this->getAssetCacheManager();
     $resolver = $this->getResolver(__DIR__ . '/../../_files/require-jquery.js');
     $assetManager = new AssetManager($resolver, $config);
     $assetManager->setAssetFilterManager($assetFilterManager);
     $assetManager->setAssetCacheManager($assetCacheManager);
     $this->request = new ConsoleRequest();
     $this->routeMatch = new RouteMatch(array('controller' => 'console'));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller = new ConsoleController($this->getMock('Zend\\Console\\Adapter\\AdapterInterface'), $assetManager, array());
     $this->controller->setEvent($this->event);
 }
예제 #4
0
 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();
 }
예제 #5
0
 public function testResponseHeadersForAsset()
 {
     $mimeResolver = new MimeResolver();
     $assetFilterManager = new AssetFilterManager();
     $assetCacheManager = $this->getAssetCacheManagerMock();
     $assetManager = new AssetManager($this->getResolver());
     $assetFilterManager->setMimeResolver($mimeResolver);
     $assetManager->setAssetFilterManager($assetFilterManager);
     $assetManager->setAssetCacheManager($assetCacheManager);
     $request = $this->getRequest();
     $assetManager->resolvesToAsset($request);
     $response = $assetManager->setAssetOnResponse(new Response());
     $thisFile = file_get_contents(__FILE__);
     if (function_exists('mb_strlen')) {
         $fileSize = mb_strlen($thisFile, '8bit');
     } else {
         $fileSize = strlen($thisFile);
     }
     $mimeType = $mimeResolver->getMimeType(__FILE__);
     $headers = 'Content-Transfer-Encoding: binary' . "\r\n";
     $headers .= 'Content-Type: ' . $mimeType . "\r\n";
     $headers .= 'Content-Length: ' . $fileSize . "\r\n";
     $this->assertSame($headers, $response->getHeaders()->toString());
 }