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 isMatch($data)
 {
     $isMatched = !$this->requiredRegexps;
     foreach ($this->requiredRegexps as $regexp) {
         if (SpeedOut_Utils::safePregMatch($regexp, $data)) {
             $isMatched = true;
             break;
         }
     }
     foreach ($this->excludedRegexps as $regexp) {
         if (SpeedOut_Utils::safePregMatch($regexp, $data)) {
             $isMatched = false;
             break;
         }
     }
     return $isMatched;
 }
Esempio n. 3
0
 /**
  * @expectedException SpeedOut_Exception
  */
 public function testSafePregMatchThrowsException()
 {
     SpeedOut_Utils::safePregMatch('~(x)[~', 'x');
 }
Esempio n. 4
0
 protected function validateNoPhpTags($linkData, $linkPath)
 {
     if (SpeedOut_Utils::safePregMatch('~^\\s*<\\?~s', $linkData)) {
         throw new SpeedOut_DataHandler_Combiner_Exception_InvalidFile($linkPath, 'File format "' . $linkPath . '" contains PHP tags');
     }
 }