/**
  * @test
  * @dataProvider getPublicPersistentResourceUriDataProvider
  * @param string $baseUri
  * @param string $relativePublicationPath
  * @param string $filename
  * @param string $sha1
  * @param string $expectedResult
  */
 public function getPublicPersistentResourceUriTests($baseUri, $relativePublicationPath, $filename, $sha1, $expectedResult)
 {
     $this->inject($this->fileSystemTarget, 'baseUri', $baseUri);
     /** @var Resource|\PHPUnit_Framework_MockObject_MockObject $mockResource */
     $mockResource = $this->getMockBuilder(Resource::class)->disableOriginalConstructor()->getMock();
     $mockResource->expects($this->any())->method('getRelativePublicationPath')->will($this->returnValue($relativePublicationPath));
     $mockResource->expects($this->any())->method('getFilename')->will($this->returnValue($filename));
     $mockResource->expects($this->any())->method('getSha1')->will($this->returnValue($sha1));
     $this->assertSame($expectedResult, $this->fileSystemTarget->getPublicPersistentResourceUri($mockResource));
 }
 /**
  * @test
  * @expectedException \TYPO3\Flow\Resource\Target\Exception
  */
 public function getPublicPersistentResourceUriThrowsExceptionIfBaseUriCantBeResolved()
 {
     $mockBootstrap = $this->getMockBuilder(Bootstrap::class)->disableOriginalConstructor()->getMock();
     $mockCommandRequestHandler = $this->getMockBuilder(CommandRequestHandler::class)->disableOriginalConstructor()->getMock();
     $mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($mockCommandRequestHandler));
     $this->inject($this->fileSystemTarget, 'bootstrap', $mockBootstrap);
     /** @var Resource|\PHPUnit_Framework_MockObject_MockObject $mockResource */
     $mockResource = $this->getMockBuilder(Resource::class)->disableOriginalConstructor()->getMock();
     $this->fileSystemTarget->getPublicStaticResourceUri($mockResource);
 }
 /**
  * Publishes the whole collection to this target
  *
  * @param \TYPO3\Flow\Resource\Collection $collection The collection to publish
  * @return void
  */
 public function publishCollection(Collection $collection)
 {
     $storage = $collection->getStorage();
     if ($storage instanceof PackageStorage) {
         foreach ($storage->getPublicResourcePaths() as $packageKey => $path) {
             $this->publishDirectory($path, $packageKey);
         }
     } else {
         parent::publishCollection($collection);
     }
 }
 /**
  * Publishes the whole collection to this target
  *
  * @param CollectionInterface $collection The collection to publish
  * @param callable $callback Function called after each resource publishing
  * @return void
  */
 public function publishCollection(CollectionInterface $collection, callable $callback = null)
 {
     $storage = $collection->getStorage();
     if ($storage instanceof PackageStorage) {
         foreach ($storage->getPublicResourcePaths() as $packageKey => $path) {
             $this->publishDirectory($path, $packageKey);
         }
     } else {
         parent::publishCollection($collection, $callback);
     }
 }
 /**
  * Set an option value and return if it was set.
  *
  * @param string $key
  * @param mixed $value
  * @return boolean
  */
 protected function setOption($key, $value)
 {
     if ($key === 'relativeSymlinks') {
         $this->relativeSymlinks = (bool) $value;
         return true;
     }
     return parent::setOption($key, $value);
 }