Skip to content

Commit 96337ef

Browse files
committed
requested changes
1 parent 9df2a69 commit 96337ef

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

src/Robot/RobotsTxt.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ public function isAllowed($userAgent, $path)
6262
*/
6363
public function isDisallowed($userAgent, $path)
6464
{
65-
$status = $this->isAllowed($userAgent, $path);
66-
if ($status===true) {
67-
return false;
68-
}
69-
70-
return true;
65+
return !$this->isAllowed($userAgent,$path);
7166
}
72-
}
67+
}

tests/RobotTest.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,16 @@ private static function getRobotsTxt($file)
2626
public function testBasicDisallow()
2727
{
2828
$this->assertFalse(self::getRobotsTxt('google')->isAllowed('robot', '/print'), 'robot cannot access /print');
29-
}
30-
31-
/**
32-
* Test that we are not allowed to access a resource which is forbidden using the isDisallowed method
33-
*/
34-
public function testBasicDisallow_Disallowed_method()
35-
{
3629
$this->assertTrue(self::getRobotsTxt('google')->isDisallowed('robot','/search'),'robot should not access /search');
3730
}
3831

39-
/**
40-
* Test that we are allowed to access a given resource using the isDisallowed method
41-
*/
42-
public function testBasicIsDisallowed_returning_false()
43-
{
44-
$this->assertFalse(self::getRobotsTxt('google')->isDisallowed('robot','/m/finance'),'robot should be able to access /m/finance');
45-
}
46-
4732
/**
4833
* Test we are allowed to access a resource with Allow:
4934
*/
5035
public function testBasicAllow()
5136
{
5237
$this->assertTrue(self::getRobotsTxt('google')->isAllowed('robot', '/m/finance'), 'robot can access /m/finance');
38+
$this->assertFalse(self::getRobotsTxt('google')->isDisallowed('robot','/m/finance'),'robot should be able to access /m/finance');
5339
}
5440

5541
/**
@@ -126,4 +112,4 @@ public function testFileWithInvalidLines()
126112
{
127113
$this->assertTrue(self::getRobotsTxt('corrupted')->isAllowed('Googlebot', '/some/other'));
128114
}
129-
}
115+
}

0 commit comments

Comments
 (0)