robotstxt : catch the errors with the associated lines.
robotstxt : more unit tests git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5986 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -119,6 +119,15 @@ class robotstxtTest extends PHPUnit_Framework_TestCase
|
||||
["http://example.com/sitemap.xml", "http://example.com/SITEMAP.XML"]);
|
||||
}
|
||||
|
||||
public function test_sitemaps_error_1 ()
|
||||
{
|
||||
$robotstxt = new robotstxt (
|
||||
"User-Agent: *\nDisallow: /\nSitemap: URL",
|
||||
"domsearch");
|
||||
$res = $robotstxt->errors ();
|
||||
$this->assertSame ($res, [2 => "Sitemap : Invalid URL provided"]);
|
||||
}
|
||||
|
||||
// Host
|
||||
public function test_host_1 ()
|
||||
{
|
||||
@@ -134,6 +143,20 @@ class robotstxtTest extends PHPUnit_Framework_TestCase
|
||||
$res = $robotstxt->host ();
|
||||
$this->assertSame ($res, "localhost");
|
||||
}
|
||||
public function test_host_error_1 ()
|
||||
{
|
||||
$robotstxt = new robotstxt (
|
||||
"User-Agent: *\nDisallow: /\n\nHost: localhost\nHoST: toto", "domsearch");
|
||||
$res = $robotstxt->host ();
|
||||
$this->assertSame ($res, "localhost");
|
||||
}
|
||||
public function test_host_error_2 ()
|
||||
{
|
||||
$robotstxt = new robotstxt (
|
||||
"User-Agent: *\nDisallow: /\n\nHost: localhost\nHoST: toto", "domsearch");
|
||||
$res = $robotstxt->errors ();
|
||||
$this->assertSame ($res, [4 => "Multiple Hosts set"]);
|
||||
}
|
||||
|
||||
// URLAllow
|
||||
public function test_urlallow_1 ()
|
||||
|
||||
Reference in New Issue
Block a user