Skip to content

Commit

Permalink
Merge pull request #10 from nanasess/fix-final-private
Browse files Browse the repository at this point in the history
PHP8-RC1 support
  • Loading branch information
nanasess authored Oct 17, 2020
2 parents dd7ca37 + d9b2ad6 commit b9db698
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,10 +966,11 @@ protected function runTest()
$this->fail($e->getMessage());
}

$testArguments = array_merge($this->data, $this->dependencyInput);
try {
$testResult = $method->invokeArgs(
$this,
array_merge($this->data, $this->dependencyInput)
array_values($testArguments)
);
} catch (Throwable $_e) {
$e = $_e;
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function __construct($filename)
/**
* @since Method available since Release 3.4.0
*/
final private function __clone()
private function __clone()
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ public function testDetermineJsonError($expected, $error, $prefix)

public static function determineJsonErrorDataprovider()
{
$unknown_error = null;
if (PHP_VERSION_ID >= 80000) {
$unknown_error = 'Unknown error';
}
return array(
'JSON_ERROR_NONE' => array(
null, 'json_error_none', ''
$unknown_error, 'json_error_none', ''
),
'JSON_ERROR_DEPTH' => array(
'Maximum stack depth exceeded', JSON_ERROR_DEPTH, ''
Expand Down
7 changes: 6 additions & 1 deletion tests/Framework/ConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,12 @@ public function testConstraintArrayContainsCheckForObjectIdentity()
// Default case.
$constraint = new PHPUnit_Framework_Constraint_TraversableContains('foo');

$this->assertTrue($constraint->evaluate(array(0), '', true));
if (PHP_VERSION_ID >= 80000) {
// see https://wiki.php.net/rfc/string_to_number_comparison
$this->assertFalse($constraint->evaluate(array(0), '', true));
} else {
$this->assertTrue($constraint->evaluate(array(0), '', true));
}
$this->assertTrue($constraint->evaluate(array(true), '', true));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Regression/GitHub/873-php7.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
GH-873: PHPUnit suppresses exceptions thrown outside of test case function
--SKIPIF--
<?php
if (PHP_MAJOR_VERSION < 7) {
if (PHP_MAJOR_VERSION != 7) {
print 'skip: PHP 7 is required';
}
?>
Expand Down
3 changes: 3 additions & 0 deletions tests/TextUI/fatal-isolation.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--TEST--
phpunit FatalTest --process-isolation ../_files/FatalTest.php
--SKIPIF--
<?php
if (PHP_VERSION_ID >= 80000) die('Skipped: xdebug_disable() is obsolete in PHP8 or later'); ?>
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
Expand Down
2 changes: 1 addition & 1 deletion tests/_files/FatalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class FatalTest extends PHPUnit_Framework_TestCase
{
public function testFatalError()
{
if (extension_loaded('xdebug')) {
if (extension_loaded('xdebug') && function_exists('xdebug_disable')) {
xdebug_disable();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/_files/Singleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ protected function __construct()
{
}

final private function __clone()
private function __clone()
{
}

Expand Down

0 comments on commit b9db698

Please sign in to comment.