Esempio n. 1
0
 public function testCombinedDataIsCorrect()
 {
     $this->assertEquals(1, SpeedOut_Utils::safePregMatch($this->getCombinedLinkRegexp(), $this->getHandledHtmlData(), $m));
     $combinedFileLink = $m[1];
     $combinedFilePath = str_replace(SpeedOut_Utils::getPathUrl(SpeedOut_Utils::getDocRoot()), SpeedOut_Utils::getDocRoot(), $combinedFileLink);
     $this->assertTrue(is_file($combinedFilePath));
     $this->assertEquals($this->getTestDataFile('_expected_combined.' . $this->getFileType()), file_get_contents($combinedFilePath));
 }
Esempio n. 2
0
 public function testStoreAndGetUrl()
 {
     $storeId = $this->generateStoreId();
     $expectedData = mt_rand();
     $this->storage->store($storeId, $expectedData);
     $actualUrl = $this->storage->getUrl($storeId);
     $this->assertTrue(SpeedOut_Utils::isExternalLink($actualUrl));
     // because of tests are running from CLI
     $actualPath = SpeedOut_Utils::getDocRoot() . substr($actualUrl, strlen(SpeedOut_Utils::getPathUrl(SpeedOut_Utils::getDocRoot())));
     $this->assertEquals($expectedData, file_get_contents($actualPath));
 }
Esempio n. 3
0
 public static function getRealLinkProvider()
 {
     return array(array(null, 'http://goo.gl', 'http://goo.gl'), array(null, 'http://goo', 'http://goo'), array(null, 'https://goo.gl', 'https://goo.gl'), array(null, 'https://goo', 'https://goo'), array(null, '/a', '/a'), array(null, 'x/y/', '/x/y'), array(SpeedOut_Utils::getDocRoot() . '/x/y/z', '../../q', '/x/q'));
 }
Esempio n. 4
0
 public function getUrl($id)
 {
     if (is_file($this->getFilePathById($id))) {
         return SpeedOut_Utils::getPathUrl(SpeedOut_Utils::getDocRoot()) . SpeedOut_Utils::getPathUri($this->getFilePathById($id));
     }
 }
Esempio n. 5
0
 /**
  * @expectedException SpeedOut_Exception
  */
 public function testInitWithNotInDocumentRootDirException()
 {
     new SpeedOut_CacheStorage_Directory(dirname(SpeedOut_Utils::getDocRoot()));
 }