Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function filterDump(AssetInterface $asset)
 {
     $asset->setContent($this->filterReferences($asset->getContent(), function ($reference) use($asset) {
         try {
             return $this->cssRewriter->rewrite($reference, $asset);
         } catch (\Exception $e) {
             throw new FilterException($e->getMessage(), $e->getCode(), $e);
         }
     }));
 }
Exemplo n.º 2
0
 public function testFilterDumpException()
 {
     $asset = $this->createAssetMock();
     $exception = new \Exception('expected message', 1234);
     $this->cssRewriter->expects($this->once())->method('rewrite')->with($this->identicalTo($reference = $this->createReference()), $this->identicalTo($asset))->will($this->throwException($exception));
     $asset->expects($this->once())->method('getContent')->will($this->returnValue($reference[0]));
     try {
         $this->cssRewriteFilter->filterDump($asset);
         $this->fail();
     } catch (FilterException $e) {
         $this->assertSame($e->getMessage(), $exception->getMessage());
         $this->assertSame($e->getCode(), $exception->getCode());
         $this->assertSame($e->getPrevious(), $exception);
     }
 }
Exemplo n.º 3
0
 /**
  * @dataProvider pathNotRewritableProvider
  */
 public function testNotRewritable($path, $sourcePath = 'source_path', $targetPath = 'target_path')
 {
     $asset = $this->createAssetMock();
     $asset->expects($this->any())->method('getSourcePath')->will($this->returnValue($sourcePath));
     $asset->expects($this->any())->method('getTargetPath')->will($this->returnValue($targetPath));
     $reference = $this->createReference($path);
     $this->assertSame($reference[0], $this->cssRewriter->rewrite($reference, $asset));
 }