Skip to content

Commit e87c55c

Browse files
committed
Revert "Try to re-enable 8.1 build using phpunit 9"
This reverts commit 62cb5df.
1 parent 62cb5df commit e87c55c

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
2626
- "7.3"
2727
- "7.4"
2828
- "8.0"
29-
- "8.1"
29+
# disabled for now as it leads to PHPUnit installing in a very old 4.3 version due to phpspec/prophecy not allowing 8.1
30+
# - "8.1"
3031

3132
steps:
3233
- name: "Checkout"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"php": "^5.3 || ^7.0 || ^8.0"
1616
},
1717
"require-dev": {
18-
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13 || ^9",
18+
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13",
1919
"phpstan/phpstan": "^0.12.59"
2020
},
2121
"autoload": {

tests/JsonParserTest.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testErrorOnTrailingComma()
6969
}');
7070
$this->fail('Invalid trailing comma should be detected');
7171
} catch (ParsingException $e) {
72-
$this->assertStringContainsStringCompat('It appears you have an extra trailing comma', $e->getMessage());
72+
$this->assertContains('It appears you have an extra trailing comma', $e->getMessage());
7373
}
7474
}
7575

@@ -82,7 +82,7 @@ public function testErrorOnInvalidQuotes()
8282
}');
8383
$this->fail('Invalid quotes for string should be detected');
8484
} catch (ParsingException $e) {
85-
$this->assertStringContainsStringCompat('Invalid string, it appears you used single quotes instead of double quotes', $e->getMessage());
85+
$this->assertContains('Invalid string, it appears you used single quotes instead of double quotes', $e->getMessage());
8686
}
8787
}
8888

@@ -95,7 +95,7 @@ public function testErrorOnUnescapedBackslash()
9595
}');
9696
$this->fail('Invalid unescaped string should be detected');
9797
} catch (ParsingException $e) {
98-
$this->assertStringContainsStringCompat('Invalid string, it appears you have an unescaped backslash at: \z', $e->getMessage());
98+
$this->assertContains('Invalid string, it appears you have an unescaped backslash at: \z', $e->getMessage());
9999
}
100100
}
101101

@@ -144,7 +144,7 @@ public function testErrorOnUnterminatedString()
144144
$parser->parse('{"bar": "foo}');
145145
$this->fail('Invalid unterminated string should be detected');
146146
} catch (ParsingException $e) {
147-
$this->assertStringContainsStringCompat('Invalid string, it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid', $e->getMessage());
147+
$this->assertContains('Invalid string, it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid', $e->getMessage());
148148
}
149149
}
150150

@@ -156,7 +156,7 @@ public function testErrorOnMultilineString()
156156
bar"}');
157157
$this->fail('Invalid multi-line string should be detected');
158158
} catch (ParsingException $e) {
159-
$this->assertStringContainsStringCompat('Invalid string, it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid', $e->getMessage());
159+
$this->assertContains('Invalid string, it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid', $e->getMessage());
160160
}
161161
}
162162

@@ -169,7 +169,7 @@ public function testErrorAtBeginning()
169169
');
170170
$this->fail('Empty string should be invalid');
171171
} catch (ParsingException $e) {
172-
$this->assertStringContainsStringCompat("Parse error on line 1:\n\n^", $e->getMessage());
172+
$this->assertContains("Parse error on line 1:\n\n^", $e->getMessage());
173173
}
174174
}
175175

@@ -189,7 +189,7 @@ public function testDetectsKeyOverrides()
189189
$parser->parse('{"a":"b", "a":"c"}', JsonParser::DETECT_KEY_CONFLICTS);
190190
$this->fail('Duplicate keys should not be allowed');
191191
} catch (DuplicateKeyException $e) {
192-
$this->assertStringContainsStringCompat('Duplicate key: a', $e->getMessage());
192+
$this->assertContains('Duplicate key: a', $e->getMessage());
193193
$this->assertSame('a', $e->getKey());
194194
$this->assertSame(array('line' => 1, 'key' => 'a'), $e->getDetails());
195195
}
@@ -206,7 +206,7 @@ public function testDetectsKeyOverridesWithEmpty()
206206
$parser->parse('{"":"b", "_empty_":"a"}', JsonParser::DETECT_KEY_CONFLICTS);
207207
$this->fail('Duplicate keys should not be allowed');
208208
} catch (DuplicateKeyException $e) {
209-
$this->assertStringContainsStringCompat('Duplicate key: _empty_', $e->getMessage());
209+
$this->assertContains('Duplicate key: _empty_', $e->getMessage());
210210
$this->assertSame('_empty_', $e->getKey());
211211
$this->assertSame(array('line' => 1, 'key' => '_empty_'), $e->getDetails());
212212
}
@@ -258,7 +258,7 @@ public function testFileWithBOM()
258258
$parser->parse(file_get_contents(dirname(__FILE__) .'/bom.json'));
259259
$this->fail('BOM should be detected');
260260
} catch (ParsingException $e) {
261-
$this->assertStringContainsStringCompat('BOM detected', $e->getMessage());
261+
$this->assertContains('BOM detected', $e->getMessage());
262262
}
263263
}
264264

@@ -269,13 +269,4 @@ public function testLongString()
269269
$json = '{"k":"' . str_repeat("a\\n",10000) . '"}';
270270
$this->assertEquals(json_decode($json), $parser->parse($json));
271271
}
272-
273-
public function assertStringContainsStringCompat($needle, $haystack, $message = '')
274-
{
275-
if (method_exists($this, 'assertStringContainsString')) {
276-
$this->assertStringContainsString($needle, $haystack, $message);
277-
} else {
278-
$this->assertContains($needle, $haystack, $message);
279-
}
280-
}
281272
}

0 commit comments

Comments
 (0)