Example #1
0
 public function testFilterAsset()
 {
     $a = new Asset();
     $a->setContent('content');
     $f = new UpperCaseFilter();
     $f->filterAsset($a);
     $this->assertEquals('CONTENT', $a->getContent());
 }
 public function serveAssetAction(Request $request, $asset_name)
 {
     try {
         $asset = new Asset($this->getAssetPath($asset_name));
         //grab the regexps to test against from the config file for this asset
         $response = new Response();
         $response->setContent($asset->getContent());
         $response->headers->set('Content-Type', $asset->getMimeType());
         $response->headers->set('X-Generated-By', get_class($this));
         $response->headers->set('Content-Length', $asset->getContentLength());
         return $response;
     } catch (\Exception $e) {
         return new Response($e->getMessage(), 404);
     }
 }
Example #3
0
 public function filterAsset(Asset &$a)
 {
     $a->setContent(strtoupper($a->getContent()));
 }
Example #4
0
 public function testGetEmptyContentLength()
 {
     $a = new Asset();
     $this->assertSame(0, $a->getContentLength());
 }