Skip to content

Commit 64c6827

Browse files
committed
Tests updated to match PHP 7 improved sorting algorithm
1 parent 3c04cf8 commit 64c6827

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

tests/AllowTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ public function testDisAllow($robotsTxtContent, $rendered)
8888
$this->assertFalse($parser->userAgent('crawlerZ')->isAllowed("/public"));
8989

9090
if ($rendered !== false) {
91+
if (version_compare(phpversion(), '7.0.0', '<')) {
92+
$this->markTestIncomplete('Sort algorithm changed as of PHP 7');
93+
}
9194
$this->assertEquals($rendered, $parser->render()->normal("\n"));
9295
$this->testDisAllow($rendered, false);
9396
}
@@ -102,6 +105,9 @@ public function testDisAllowIsListed($robotsTxtContent, $rendered)
102105
{
103106
$parser = new RobotsTxtParser\TxtClient('http://example.com', 200, $robotsTxtContent);
104107
$this->assertInstanceOf('vipnytt\RobotsTxtParser\TxtClient', $parser);
108+
if (version_compare(phpversion(), '7.0.0', '<')) {
109+
$this->markTestIncomplete('Sort algorithm changed as of PHP 7');
110+
}
105111
$this->assertEquals($rendered, $parser->render()->normal("\n"));
106112

107113
// Expected result: String length of matching rule
@@ -157,8 +163,8 @@ public function generateDataForTest()
157163
User-agent: *
158164
User-agent: anyone
159165
Disallow: /temp
160-
Disallow: /admin
161166
Disallow: /forum
167+
Disallow: /admin
162168
Disallow: /Admin
163169
Disallow: /admin/cp/test/
164170
@@ -169,8 +175,8 @@ public function generateDataForTest()
169175
170176
User-agent: boty
171177
Disallow: /
172-
Allow: /article
173178
Allow: /forum/$
179+
Allow: /article
174180
175181
User-agent: crawlerz
176182
Disallow: /

tests/EndAnchorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public function testEndAnchor($robotsTxtContent, $rendered)
4242
$this->assertFalse($parser->userAgent('DenyMe')->isAllowed('http://example.com/deny_all/'));
4343

4444
if ($rendered !== false) {
45+
if (version_compare(phpversion(), '7.0.0', '<')) {
46+
$this->markTestIncomplete('Sort algorithm changed as of PHP 7');
47+
}
4548
$this->assertEquals($rendered, $parser->render()->normal("\n"));
4649
$this->testEndAnchor($rendered, false);
4750
}
@@ -74,8 +77,8 @@ public function generateDataForTest()
7477
Allow: /$
7578
7679
User-agent: denyme
77-
Disallow: *deny_all/$
7880
Disallow: /deny_all/$
81+
Disallow: *deny_all/$
7982
RENDERED
8083
]
8184
];

tests/EscapingTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public function testEscaping($robotsTxtContent, $rendered)
3939
//$this->assertFalse($parser->userAgent()->isAllowed("/("));
4040

4141
if ($rendered !== false) {
42+
if (version_compare(phpversion(), '7.0.0', '<')) {
43+
$this->markTestIncomplete('Sort algorithm changed as of PHP 7');
44+
}
4245
$this->assertEquals($rendered, $parser->render()->normal("\n"));
4346
$this->testEscaping($rendered, false);
4447
}
@@ -62,9 +65,9 @@ public function generateDataForTest()
6265
,
6366
<<<RENDERED
6467
User-agent: *
65-
Disallow: /(
66-
Disallow: /)
6768
Disallow: /.
69+
Disallow: /)
70+
Disallow: /(
6871
RENDERED
6972
]
7073
];

0 commit comments

Comments
 (0)