Пример #1
0
 public static function suite()
 {
     $url = "@SITE_URL@";
     $crawler =& new MyCrawler();
     // URL to crawl
     $crawler->setURL($url);
     // Only receive content of files with content-type "text/html"
     // (regular expression, preg)
     $crawler->addReceiveContentType("/text\\/html/");
     // Ignore links to pictures, dont even request pictures
     // (preg_match)
     $crawler->addNonFollowMatch("/.(jpg|gif|png|css|js|swf)\$/ i");
     // Store and send cookie-data like a browser does
     $crawler->setCookieHandling(true);
     // Set the traffic-limit to 10 MB (in bytes,
     // for testing we dont want to "suck" the whole site)
     $crawler->setTrafficLimit(10000 * 1024);
     // Thats enough, now here we go
     $crawler->go();
     // At the end, after the process is finished, we print a short
     // report (see method getReport() for more information)
     $report = $crawler->getReport();
     echo "Summary:\n";
     if ($report["traffic_limit_reached"] == true) {
         echo "Traffic-limit reached \n";
     }
     print_r($report);
     echo "\npages\n";
     print_r(array_unique($crawler->pages));
     echo "\nerrors\n\n";
     print_r(array_unique($crawler->error_pages));
     echo "\nnot found\n\n";
     print_r(array_unique($crawler->notfound_pages));
     if (sizeof($crawler->pages) == 0) {
         exit(1);
     }
     if (sizeof($crawler->error_pages) > 0) {
         exit(1);
     }
     if (sizeof($crawler->notfound_pages) > 0) {
         exit(1);
     }
     return parent::suite(array('html' => array('validator' => 'http://validator.w3.org/check', 'tests' => $crawler->pages)));
 }
 public function setup()
 {
     $this->setLintCommand(TheCodeTrainEasyFrontendTestSuite::getValidatorUrl('js'));
 }
 public static function suite()
 {
     return parent::suite(array('html' => array('validator' => 'http://validator.w3.org/check', 'tests' => array('http://yahoo.com/'))));
 }