diff --git a/src/Client/Directives/UserAgentTools.php b/src/Client/Directives/UserAgentTools.php index 7ceb967..2f97ddb 100644 --- a/src/Client/Directives/UserAgentTools.php +++ b/src/Client/Directives/UserAgentTools.php @@ -133,7 +133,7 @@ private function checkPath($directive, $uri) self::DIRECTIVE_NO_INDEX => $this->handler->noIndex(), self::DIRECTIVE_DISALLOW => $this->handler->disallow(), self::DIRECTIVE_ALLOW => $this->handler->allow(), - ] as $currentDirective => &$handler) { + ] as $currentDirective => $handler) { if ($handler->client()->isListed($uri)) { if ($currentDirective === self::DIRECTIVE_NO_INDEX) { return $directive === self::DIRECTIVE_DISALLOW; diff --git a/tests/CleanParamTest.php b/tests/CleanParamTest.php index b901388..024aaec 100644 --- a/tests/CleanParamTest.php +++ b/tests/CleanParamTest.php @@ -37,9 +37,11 @@ public function testCleanParam($robotsTxtContent, $result, $rendered) $this->assertEquals($result['Clean-param'], $parser->cleanParam()->export()); - $this->assertEquals($result['NoIndex'], $parser->userAgent()->noIndex()->cleanParam()->export()); - $this->assertEquals($result['Disallow'], $parser->userAgent()->disallow()->cleanParam()->export()); - $this->assertEquals($result['Allow'], $parser->userAgent()->allow()->cleanParam()->export()); + for ($i = 1; $i <= 2; $i++) { + $this->assertEquals($result['NoIndex'], $parser->userAgent()->noIndex()->cleanParam()->export()); + $this->assertEquals($result['Disallow'], $parser->userAgent()->disallow()->cleanParam()->export()); + $this->assertEquals($result['Allow'], $parser->userAgent()->allow()->cleanParam()->export()); + } if ($rendered !== false) { $this->assertEquals($rendered, $parser->render()->normal("\n")); diff --git a/tests/HostTest.php b/tests/HostTest.php index 039b73c..055a6ff 100644 --- a/tests/HostTest.php +++ b/tests/HostTest.php @@ -37,9 +37,11 @@ public function testHost($robotsTxtContent, $rendered) $this->assertEquals('myhost.com', $parser->host()->getWithUriFallback()); $this->assertFalse($parser->host()->isPreferred()); - $this->assertFalse($parser->userAgent()->allow()->host()->isListed('http://www.myhost.com/')); - $this->assertTrue($parser->userAgent()->disallow()->host()->isListed('http://www.myhost.com/')); - $this->assertFalse($parser->userAgent()->noIndex()->host()->isListed('http://www.myhost.com/')); + for ($i = 1; $i <= 2; $i++) { + $this->assertFalse($parser->userAgent()->allow()->host()->isListed('http://www.myhost.com/')); + $this->assertTrue($parser->userAgent()->disallow()->host()->isListed('http://www.myhost.com/')); + $this->assertFalse($parser->userAgent()->noIndex()->host()->isListed('http://www.myhost.com/')); + } if ($rendered !== false) { $this->assertEquals($rendered, $parser->render()->normal("\n"));