Composer upgrade

This commit is contained in:
Clemens Schwaighofer
2022-02-24 13:44:33 +09:00
parent f2c0ba737a
commit c8d7b308b3
86 changed files with 961 additions and 716 deletions

View File

@@ -2,6 +2,23 @@
All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [8.5.24] - 2022-MM-DD
### Changed
* [#4874](https://github.com/sebastianbergmann/phpunit/pull/4874): `PHP_FLOAT_EPSILON` is now used instead of hardcoded `0.0000000001` in `PHPUnit\Framework\Constraint\IsIdentical`
### Fixed
* When the HTML code coverage report's configured low upper bound is larger than the high lower bound then the default values are used instead
## [8.5.23] - 2022-01-21
### Fixed
* [#4799](https://github.com/sebastianbergmann/phpunit/pull/4799): Memory leaks in `PHPUnit\Framework\TestSuite` class
* [#4857](https://github.com/sebastianbergmann/phpunit/pull/4857): Result of `debug_backtrace()` is not used correctly
## [8.5.22] - 2021-12-25
### Changed
@@ -190,6 +207,8 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil
* [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable`
* [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside
[8.5.24]: https://github.com/sebastianbergmann/phpunit/compare/8.5.23...8.5
[8.5.23]: https://github.com/sebastianbergmann/phpunit/compare/8.5.22...8.5.23
[8.5.22]: https://github.com/sebastianbergmann/phpunit/compare/8.5.21...8.5.22
[8.5.21]: https://github.com/sebastianbergmann/phpunit/compare/8.5.20...8.5.21
[8.5.20]: https://github.com/sebastianbergmann/phpunit/compare/8.5.19...8.5.20

View File

@@ -2,6 +2,37 @@
All notable changes of the PHPUnit 9.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [9.5.16] - 2022-02-23
### Changed
* Reverted sync with API change in (now yanked) phpunit/php-code-coverage 9.2.12
## [9.5.15] - 2022-02-23 [YANKED]
### Fixed
* When the HTML code coverage report's configured low upper bound is larger than the high lower bound then the default values are used instead
## [9.5.14] - 2022-02-18
### Changed
* [#4874](https://github.com/sebastianbergmann/phpunit/pull/4874): `PHP_FLOAT_EPSILON` is now used instead of hardcoded `0.0000000001` in `PHPUnit\Framework\Constraint\IsIdentical`
## [9.5.13] - 2022-01-24
### Fixed
* [#4871](https://github.com/sebastianbergmann/phpunit/issues/4871): Class `SebastianBergmann\CodeCoverage\Filter` is not found during PHPT tests when PHPUnit is used from PHAR
## [9.5.12] - 2022-01-21
### Fixed
* [#4799](https://github.com/sebastianbergmann/phpunit/pull/4799): Memory leaks in `PHPUnit\Framework\TestSuite` class
* [#4857](https://github.com/sebastianbergmann/phpunit/pull/4857): Result of `debug_backtrace()` is not used correctly
## [9.5.11] - 2021-12-25
### Changed
@@ -103,6 +134,11 @@ All notable changes of the PHPUnit 9.5 release series are documented in this fil
* [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly
[9.5.16]: https://github.com/sebastianbergmann/phpunit/compare/dc738383c519243b0a967f63943a848d3fd861aa...9.5.16
[9.5.15]: https://github.com/sebastianbergmann/phpunit/compare/9.5.14...dc738383c519243b0a967f63943a848d3fd861aa
[9.5.14]: https://github.com/sebastianbergmann/phpunit/compare/9.5.13...9.5.14
[9.5.13]: https://github.com/sebastianbergmann/phpunit/compare/9.5.12...9.5.13
[9.5.12]: https://github.com/sebastianbergmann/phpunit/compare/9.5.11...9.5.12
[9.5.11]: https://github.com/sebastianbergmann/phpunit/compare/9.5.10...9.5.11
[9.5.10]: https://github.com/sebastianbergmann/phpunit/compare/9.5.9...9.5.10
[9.5.9]: https://github.com/sebastianbergmann/phpunit/compare/9.5.8...9.5.9

View File

@@ -1,6 +1,6 @@
PHPUnit
Copyright (c) 2001-2021, Sebastian Bergmann <sebastian@phpunit.de>.
Copyright (c) 2001-2022, Sebastian Bergmann <sebastian@phpunit.de>.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -33,7 +33,7 @@
"phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2",
"phpspec/prophecy": "^1.12.1",
"phpunit/php-code-coverage": "^9.2.7",
"phpunit/php-code-coverage": "^9.2.13",
"phpunit/php-file-iterator": "^3.0.5",
"phpunit/php-invoker": "^3.1.1",
"phpunit/php-text-template": "^2.0.3",

View File

@@ -179,7 +179,7 @@ abstract class Constraint implements Countable, SelfDescribing
* Returns the description of the failure when this constraint appears in
* context of an $operator expression.
*
* The purpose of this method is to provide meaningful failue description
* The purpose of this method is to provide meaningful failure description
* in context of operators such as LogicalNot. Native PHPUnit constraints
* are supported out of the box by LogicalNot, but externally developed
* ones had no way to provide correct messages in this context.

View File

@@ -9,6 +9,7 @@
*/
namespace PHPUnit\Framework\Constraint;
use const PHP_FLOAT_EPSILON;
use function abs;
use function get_class;
use function is_array;
@@ -26,11 +27,6 @@ use SebastianBergmann\Comparator\ComparisonFailure;
*/
final class IsIdentical extends Constraint
{
/**
* @var float
*/
private const EPSILON = 0.0000000001;
/**
* @var mixed
*/
@@ -59,7 +55,7 @@ final class IsIdentical extends Constraint
if (is_float($this->value) && is_float($other) &&
!is_infinite($this->value) && !is_infinite($other) &&
!is_nan($this->value) && !is_nan($other)) {
$success = abs($this->value - $other) < self::EPSILON;
$success = abs($this->value - $other) < PHP_FLOAT_EPSILON;
} else {
$success = $this->value === $other;
}

View File

@@ -21,14 +21,18 @@ final class InvalidArgumentException extends Exception
{
public static function create(int $argument, string $type): self
{
$stack = debug_backtrace();
$stack = debug_backtrace();
$function = $stack[1]['function'];
if (isset($stack[1]['class'])) {
$function = sprintf('%s::%s', $stack[1]['class'], $stack[1]['function']);
}
return new self(
sprintf(
'Argument #%d of %s::%s() must be %s %s',
'Argument #%d of %s() must be %s %s',
$argument,
$stack[1]['class'],
$stack[1]['function'],
$function,
in_array(lcfirst($type)[0], ['a', 'e', 'i', 'o', 'u'], true) ? 'an' : 'a',
$type
)

View File

@@ -12,74 +12,34 @@ namespace PHPUnit\Framework;
use Throwable;
/**
* @deprecated Use the `TestHook` interfaces instead
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @deprecated
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface TestListener
{
/**
* An error occurred.
*
* @deprecated Use `AfterTestErrorHook::executeAfterTestError` instead
*/
public function addError(Test $test, Throwable $t, float $time): void;
/**
* A warning occurred.
*
* @deprecated Use `AfterTestWarningHook::executeAfterTestWarning` instead
*/
public function addWarning(Test $test, Warning $e, float $time): void;
/**
* A failure occurred.
*
* @deprecated Use `AfterTestFailureHook::executeAfterTestFailure` instead
*/
public function addFailure(Test $test, AssertionFailedError $e, float $time): void;
/**
* Incomplete test.
*
* @deprecated Use `AfterIncompleteTestHook::executeAfterIncompleteTest` instead
*/
public function addIncompleteTest(Test $test, Throwable $t, float $time): void;
/**
* Risky test.
*
* @deprecated Use `AfterRiskyTestHook::executeAfterRiskyTest` instead
*/
public function addRiskyTest(Test $test, Throwable $t, float $time): void;
/**
* Skipped test.
*
* @deprecated Use `AfterSkippedTestHook::executeAfterSkippedTest` instead
*/
public function addSkippedTest(Test $test, Throwable $t, float $time): void;
/**
* A test suite started.
*/
public function startTestSuite(TestSuite $suite): void;
/**
* A test suite ended.
*/
public function endTestSuite(TestSuite $suite): void;
/**
* A test started.
*
* @deprecated Use `BeforeTestHook::executeBeforeTest` instead
*/
public function startTest(Test $test): void;
/**
* A test ended.
*
* @deprecated Use `AfterTestHook::executeAfterTest` instead
*/
public function endTest(Test $test, float $time): void;
}

View File

@@ -755,8 +755,8 @@ final class TestResult implements Countable
sprintf(
'%s in %s:%s',
$e->getMessage(),
$frame['file'],
$frame['line']
$frame['file'] ?? $e->getFile(),
$frame['line'] ?? $e->getLine()
)
);
} catch (Warning $e) {

View File

@@ -10,7 +10,6 @@
namespace PHPUnit\Framework;
use const PHP_EOL;
use function array_diff;
use function array_keys;
use function array_map;
use function array_merge;
@@ -128,9 +127,9 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
private $iteratorFilter;
/**
* @var string[]
* @var int
*/
private $declaredClasses;
private $declaredClassesPointer;
/**
* @psalm-var array<int,string>
@@ -167,7 +166,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
);
}
$this->declaredClasses = get_declared_classes();
$this->declaredClassesPointer = count(get_declared_classes());
if (!$theClass instanceof ReflectionClass) {
if (class_exists($theClass, true)) {
@@ -390,7 +389,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
if (is_file($filename) && substr($filename, -5) === '.phpt') {
$this->addTest(new PhptTestCase($filename));
$this->declaredClasses = get_declared_classes();
$this->declaredClassesPointer = count(get_declared_classes());
return;
}
@@ -400,7 +399,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
// The given file may contain further stub classes in addition to the
// test class itself. Figure out the actual test class.
$filename = FileLoader::checkAndLoad($filename);
$newClasses = array_diff(get_declared_classes(), $this->declaredClasses);
$newClasses = array_slice(get_declared_classes(), $this->declaredClassesPointer);
// The diff is empty in case a parent class (with test methods) is added
// AFTER a child class that inherited from it. To account for that case,
@@ -410,8 +409,8 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
// On the assumption that test classes are defined first in files,
// process discovered classes in approximate LIFO order, so as to
// avoid unnecessary reflection.
$this->foundClasses = array_merge($newClasses, $this->foundClasses);
$this->declaredClasses = get_declared_classes();
$this->foundClasses = array_merge($newClasses, $this->foundClasses);
$this->declaredClassesPointer = count(get_declared_classes());
}
// The test class's name must match the filename, either in full, or as

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterIncompleteTestHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterLastTestHook extends Hook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterRiskyTestHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterSkippedTestHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterSuccessfulTestHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterTestErrorHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterTestFailureHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterTestHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface AfterTestWarningHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface BeforeFirstTestHook extends Hook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface BeforeTestHook extends TestHook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface Hook
{

View File

@@ -10,7 +10,13 @@
namespace PHPUnit\Runner;
/**
* This interface, as well as the associated mechanism for extending PHPUnit,
* will be removed in PHPUnit 10. There is no alternative available in this
* version of PHPUnit.
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @see https://github.com/sebastianbergmann/phpunit/issues/4676
*/
interface TestHook extends Hook
{

View File

@@ -41,7 +41,7 @@ final class Version
}
if (self::$version === '') {
self::$version = (new VersionId('9.5.11', dirname(__DIR__, 2)))->getVersion();
self::$version = (new VersionId('9.5.16', dirname(__DIR__, 2)))->getVersion();
}
return self::$version;

View File

@@ -93,11 +93,6 @@ final class TestRunner extends BaseTestRunner
public const EXCEPTION_EXIT = 2;
/**
* @var bool
*/
private static $versionStringPrinted = false;
/**
* @var CodeCoverageFilter
*/
@@ -334,8 +329,6 @@ final class TestRunner extends BaseTestRunner
Version::getVersionString() . "\n"
);
self::$versionStringPrinted = true;
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
@@ -1142,6 +1135,11 @@ final class TestRunner extends BaseTestRunner
$arguments['timeoutForMediumTests'] = $arguments['timeoutForMediumTests'] ?? 10;
$arguments['timeoutForSmallTests'] = $arguments['timeoutForSmallTests'] ?? 1;
$arguments['verbose'] = $arguments['verbose'] ?? false;
if ($arguments['reportLowUpperBound'] > $arguments['reportHighLowerBound']) {
$arguments['reportLowUpperBound'] = 50;
$arguments['reportHighLowerBound'] = 90;
}
}
private function processSuiteFilters(TestSuite $suite, array $arguments): void