/** * @covers itseo\test\Flash::test * @todo Implement testTest(). */ public function testTest() { $dummy_dom = Itseo::extractDOM(file_get_contents("http://www.google.es/")); $result = $this->object->test($dummy_dom); $this->assertArrayHasKey("name", $result); $this->assertArrayHasKey("score", $result); $this->assertArrayHasKey("total_score", $result); $this->assertArrayHasKey("result", $result); $this->assertEquals("flash", $result['name']); }
public function test($target, $domain = "localhost") { $dmoz_HTML = file_get_contents('http://www.dmoz.org/search/?q=' . $domain); if ($dmoz_HTML) { $DOM = Itseo::extractDOM($dmoz_HTML); $aux = $DOM->getElementsByTagName('a'); foreach ($aux as $link) { if ($link->getAttribute('href') == $target) { $this->in_dmoz = true; $this->result .= '<p><span class="result ok">OK</span>Your site is listed in DMOZ directory.</p>' . "\n"; $this->score += 1; break; } } if ($this->in_dmoz !== true) { $this->result .= '<p><span class="result error">ERROR</span>Your site its not listed in DMOZ directory</p>' . "\n"; } } return array("name" => "dmoz", "score" => $this->score, "total_score" => self::TOTAL_SCORE, "result" => $this->result); }
{ $files = scandir($dir); foreach ($files as $file) { if ($file == "." || $file == "..") { continue; } $tmp_dir = $dir . DIRECTORY_SEPARATOR . $file; if (is_dir($tmp_dir)) { autoload($tmp_dir); } elseif (is_readable($tmp_dir)) { require_once $tmp_dir; } } } autoload(getcwd() . DIRECTORY_SEPARATOR . "itseo"); $itseo = new Itseo("http://www.google.es/"); $itseo->makeTest('Dmoz'); $itseo->makeTest('Favicon'); $itseo->makeTest('Flash'); $itseo->makeTest('Frames'); $itseo->makeTest('Headings'); $itseo->makeTest('Img'); $itseo->makeTest('Links'); $itseo->makeTest('MetaTitle'); $itseo->makeTest('MetaDescription'); $itseo->makeTest('MetaKeywords'); $itseo->makeTest('Www'); $itseo->makeTest('UrlLength'); $itseo->makeTest('Title'); $itseo->makeTest('TextRatio'); $itseo->makeTest('Sitemap');
/** * @covers itseo\Itseo::makeTest * @todo Implement testMakeTest(). * @expectedException Exception */ public function testMakeTest() { $dummy_test = "dummy"; $this->object->makeTest($dummy_test); $this->assertArrayHasKey($dummy_test, $this->object->tests); }