コード例 #1
0
 function testUrlsToPathsWithDomainBasedCaching()
 {
     $origDomainBasedCaching = FilesystemPublisher::$domain_based_caching;
     FilesystemPublisher::$domain_based_caching = true;
     $fsp = new FilesystemPublisher('.', 'html');
     $url = 'http://domain1.com/';
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => 'domain1.com/index.html'), 'Root URL path mapping');
     $url = 'http://domain1.com/about-us';
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => 'domain1.com/about-us.html'), 'URLsegment path mapping');
     $url = 'http://domain2.com/parent/child';
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => 'domain2.com/parent/child.html'), 'Nested URLsegment path mapping');
     FilesystemPublisher::$domain_based_caching = $origDomainBasedCaching;
 }
 public function testUrlsToPathsWithDomainBasedCaching()
 {
     $origDomainBasedCaching = Config::inst()->get('FilesystemPublisher', 'domain_based_caching');
     Config::inst()->update('FilesystemPublisher', 'domain_based_caching', true);
     $fsp = new FilesystemPublisher('.', 'html');
     $url = 'http://domain1.com/';
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => 'domain1.com/index.html'), 'Root URL path mapping');
     $url = 'http://domain1.com/about-us';
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => 'domain1.com/about-us.html'), 'URLsegment path mapping');
     $url = 'http://domain2.com/parent/child';
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => 'domain2.com/parent/child.html'), 'Nested URLsegment path mapping');
     Config::inst()->update('FilesystemPublisher', 'domain_based_caching', $origDomainBasedCaching);
 }