Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 2cfb4b4

Browse files
committed
fixed for phpunit 6
1 parent 980c4a6 commit 2cfb4b4

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
2+
composer.lock
23
vendor

src/Constraint/JsonType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function matches($jsonArray)
3939
}
4040
} else {
4141
if ($matched === true) {
42-
throw new \PHPUnit\Framework\ExpectationFailedException('Unexpectedly response matched: ' . json\encode($jsonArray));
42+
throw new \PHPUnit\Framework\ExpectationFailedException('Unexpectedly response matched: ' . json_encode($jsonArray));
4343
}
4444
}
4545
return true;

src/shim.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ class_alias('PHPUnit_Util_TestDox_ResultPrinter', 'PHPUnit\Util\TestDox\ResultPr
4040

4141
}
4242
if (!class_exists('\PHPUnit\Util\Log\JSON') || !class_exists('\PHPUnit\Util\Log\TAP')) {
43-
require_once __DIR__ . '/phpunit5-loggers.php'; // TAP and JSON loggers were removed in PHPUnit 6
43+
if (class_exists('\PHPUnit\Util\Printer')) {
44+
require_once __DIR__ . '/phpunit5-loggers.php'; // TAP and JSON loggers were removed in PHPUnit 6
45+
}
4446
}
4547

4648
// phpunit codecoverage updates
47-
if (!class_exists('SebastianBergmann\CodeCoverage\CodeCoverage')) {
49+
if (!class_exists('SebastianBergmann\CodeCoverage\CodeCoverage') && class_exists('PHP_CodeCoverage')) {
4850
class_alias('PHP_CodeCoverage', 'SebastianBergmann\CodeCoverage\CodeCoverage');
4951
class_alias('PHP_CodeCoverage_Report_Text', 'SebastianBergmann\CodeCoverage\Report\Text');
5052
class_alias('PHP_CodeCoverage_Report_PHP', 'SebastianBergmann\CodeCoverage\Report\PHP');
@@ -54,6 +56,10 @@ class_alias('PHP_CodeCoverage_Report_HTML', 'SebastianBergmann\CodeCoverage\Repo
5456
class_alias('PHP_CodeCoverage_Report_XML', 'SebastianBergmann\CodeCoverage\Report\Xml\Facade');
5557
class_alias('PHP_CodeCoverage_Exception', 'SebastianBergmann\CodeCoverage\Exception');
5658
}
59+
60+
if (!class_exists('\PHPUnit\Framework\Constraint\LogicalNot') && class_exists('\PHPUnit\Framework\Constraint\Not')) {
61+
class_alias('\PHPUnit\Framework\Constraint\Not', '\PHPUnit\Framework\Constraint\LogicalNot');
62+
}
5763
}
5864

5965
// @codingStandardsIgnoreEnd

0 commit comments

Comments
 (0)