From 64c682728988a8d883e929e0b7a36bc9ba610545 Mon Sep 17 00:00:00 2001 From: jpg Date: Wed, 14 Feb 2018 23:50:43 +0100 Subject: [PATCH] Tests updated to match PHP 7 improved sorting algorithm --- tests/AllowTest.php | 10 ++++++++-- tests/EndAnchorTest.php | 5 ++++- tests/EscapingTest.php | 7 +++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/AllowTest.php b/tests/AllowTest.php index b2933ba..f9192f5 100644 --- a/tests/AllowTest.php +++ b/tests/AllowTest.php @@ -88,6 +88,9 @@ public function testDisAllow($robotsTxtContent, $rendered) $this->assertFalse($parser->userAgent('crawlerZ')->isAllowed("/public")); if ($rendered !== false) { + if (version_compare(phpversion(), '7.0.0', '<')) { + $this->markTestIncomplete('Sort algorithm changed as of PHP 7'); + } $this->assertEquals($rendered, $parser->render()->normal("\n")); $this->testDisAllow($rendered, false); } @@ -102,6 +105,9 @@ public function testDisAllowIsListed($robotsTxtContent, $rendered) { $parser = new RobotsTxtParser\TxtClient('http://example.com', 200, $robotsTxtContent); $this->assertInstanceOf('vipnytt\RobotsTxtParser\TxtClient', $parser); + if (version_compare(phpversion(), '7.0.0', '<')) { + $this->markTestIncomplete('Sort algorithm changed as of PHP 7'); + } $this->assertEquals($rendered, $parser->render()->normal("\n")); // Expected result: String length of matching rule @@ -157,8 +163,8 @@ public function generateDataForTest() User-agent: * User-agent: anyone Disallow: /temp -Disallow: /admin Disallow: /forum +Disallow: /admin Disallow: /Admin Disallow: /admin/cp/test/ @@ -169,8 +175,8 @@ public function generateDataForTest() User-agent: boty Disallow: / -Allow: /article Allow: /forum/$ +Allow: /article User-agent: crawlerz Disallow: / diff --git a/tests/EndAnchorTest.php b/tests/EndAnchorTest.php index 6b86aa7..92542d2 100644 --- a/tests/EndAnchorTest.php +++ b/tests/EndAnchorTest.php @@ -42,6 +42,9 @@ public function testEndAnchor($robotsTxtContent, $rendered) $this->assertFalse($parser->userAgent('DenyMe')->isAllowed('http://example.com/deny_all/')); if ($rendered !== false) { + if (version_compare(phpversion(), '7.0.0', '<')) { + $this->markTestIncomplete('Sort algorithm changed as of PHP 7'); + } $this->assertEquals($rendered, $parser->render()->normal("\n")); $this->testEndAnchor($rendered, false); } @@ -74,8 +77,8 @@ public function generateDataForTest() Allow: /$ User-agent: denyme -Disallow: *deny_all/$ Disallow: /deny_all/$ +Disallow: *deny_all/$ RENDERED ] ]; diff --git a/tests/EscapingTest.php b/tests/EscapingTest.php index 65e688d..c5db692 100644 --- a/tests/EscapingTest.php +++ b/tests/EscapingTest.php @@ -39,6 +39,9 @@ public function testEscaping($robotsTxtContent, $rendered) //$this->assertFalse($parser->userAgent()->isAllowed("/(")); if ($rendered !== false) { + if (version_compare(phpversion(), '7.0.0', '<')) { + $this->markTestIncomplete('Sort algorithm changed as of PHP 7'); + } $this->assertEquals($rendered, $parser->render()->normal("\n")); $this->testEscaping($rendered, false); } @@ -62,9 +65,9 @@ public function generateDataForTest() , <<