예제 #1
0
 /**
  * @test
  */
 public function getUri()
 {
     $baseUri = 'http://www.foo.com/';
     $path = 'uploads/images/foo.jpg';
     $server = $this->getMock('Tx_Asdis_Domain_Model_Server', array('getUri'));
     $server->expects($this->once())->method('getUri')->will($this->returnValue($baseUri));
     $this->asset->setNormalizedPath($path);
     $this->asset->setServer($server);
     $this->assertEquals($baseUri . $path, $this->asset->getUri());
 }
예제 #2
0
파일: Url.php 프로젝트: AOEpeople/asdis
 /**
  * @param string $path
  * @return string
  */
 public function getDistributedUrlForPath($path)
 {
     if (empty($path)) {
         return null;
     }
     $asset = new Tx_Asdis_Domain_Model_Asset();
     $asset->setOriginalPath($path);
     $asset->setNormalizedPath($this->uriNormalizer->normalizePath($path));
     $this->distributeAsset($asset);
     return $asset->getUri();
 }
예제 #3
0
 /**
  * @test
  */
 public function getReplacementMap()
 {
     $collection = new Tx_Asdis_Domain_Model_Asset_Collection();
     $asset1 = new Tx_Asdis_Domain_Model_Asset();
     $asset2 = new Tx_Asdis_Domain_Model_Asset();
     $path1 = 'typo3temp/pics/foo.gif';
     $path2 = 'typo3temp/pics/bar.jpg';
     $asset1->setOriginalPath($path1);
     $asset1->setNormalizedPath($path1);
     $asset2->setOriginalPath($path2);
     $asset2->setNormalizedPath($path2);
     $collection->append($asset1);
     $collection->append($asset2);
     $map = $collection->getReplacementMap();
     $this->assertEquals(2, sizeof($map->getSources()));
     $this->assertEquals(2, sizeof($map->getTargets()));
 }