Пример #1
0
 /**
  * Test execution.
  *
  * @param Document $htmlDocument the HTML dokument to test
  */
 public function runTest(Document $htmlDocument)
 {
     static $requestedDependecies = array();
     $failedUrls = array();
     $files = $htmlDocument->getExternalDependencies();
     $requestUri = new Uri($this->getRequest()->getUri());
     $domain = $requestUri->getDomain();
     foreach ($files as $file) {
         $absoluteFile = $domain->concatUri($file);
         if (!$this->isIgnored($absoluteFile->toString())) {
             if (array_key_exists($absoluteFile->toString(), $requestedDependecies)) {
                 $status = $requestedDependecies[$absoluteFile->toString()];
             } else {
                 $request = Symfony::create($absoluteFile, Request::GET);
                 $client = new Zend();
                 $response = $client->request($request);
                 $status = $response->getStatus();
                 $requestedDependecies[$absoluteFile->toString()] = $response->getStatus();
             }
             if ($status >= 400) {
                 $failedUrls[] = $absoluteFile->toString();
             }
         }
     }
     if (count($failedUrls) > 0) {
         $this->handleFailures($failedUrls);
     }
 }
Пример #2
0
 /**
  * @Event("LiveTest.Run.PostRun")
  *
  * @param Information $information
  */
 public function postRun(Information $information)
 {
     try {
         $postData = array('urls' => $this->urls, 'tests' => $this->tests);
         $request = Symfony::create(new Uri(self::PHM_API), Request::GET, $postData);
         $client = new Zend();
         $response = $client->request($request);
     } catch (\Exception $e) {
     }
 }