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)); }
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)); }
public function getUrl($id) { if (is_file($this->getFilePathById($id))) { return SpeedOut_Utils::getPathUrl(SpeedOut_Utils::getDocRoot()) . SpeedOut_Utils::getPathUri($this->getFilePathById($id)); } }