public function testClearWithoutPrefix()
 {
     $filename = $this->cacheDir . '/thumbnails/cats.jpeg';
     $this->filesystem->mkdir(dirname($filename));
     file_put_contents($filename, '42');
     $this->assertTrue(file_exists($filename));
     try {
         // This would effectively clear the web root.
         $this->resolver->clear('');
         $this->fail('Clear should not work without a valid cache prefix');
     } catch (\Exception $e) {
     }
     $this->assertTrue(file_exists($filename));
 }
 public function testRemoveCacheForSomeFiltersOnRemove()
 {
     $filesystemMock = $this->createFilesystemMock();
     $filesystemMock->expects($this->once())->method('remove')->with(array('/aWebRoot/aCachePrefix/aFilterOne', '/aWebRoot/aCachePrefix/aFilterTwo'));
     $resolver = new WebPathResolver($filesystemMock, new RequestContext(), '/aWebRoot', 'aCachePrefix');
     $resolver->remove(array(), array('aFilterOne', 'aFilterTwo'));
 }
 /**
  * {@inheritdoc}
  */
 protected function getFileUrl($path, $filter)
 {
     $filterConf = $this->filterConfig->get($filter);
     $path = $this->changeFileExtension($path, $filterConf['format']);
     return parent::getFileUrl($path, $filter);
 }
 /**
  * Constructor
  *
  * @param Filesystem $filesystem
  * @param string     $rootDir
  */
 public function __construct(Filesystem $filesystem, $rootDir)
 {
     parent::__construct($filesystem);
     $this->rootDir = $rootDir;
 }