Missing dependancies
This commit is contained in:
+50
@@ -2,6 +2,49 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [9.2.26] - 2023-03-06
|
||||
|
||||
### Changed
|
||||
|
||||
* Improved the legend on the file pages of the HTML code coverage report
|
||||
|
||||
## [9.2.25] - 2023-02-25
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#981](https://github.com/sebastianbergmann/php-code-coverage/issues/981): `CodeUnitFindingVisitor` does not support DNF types
|
||||
|
||||
## [9.2.24] - 2023-01-26
|
||||
|
||||
### Changed
|
||||
|
||||
* [#970](https://github.com/sebastianbergmann/php-code-coverage/issues/970): CSS and JavaScript assets are now referenced using `?v=%s` URLs in the HTML report to avoid cache issues
|
||||
|
||||
## [9.2.23] - 2022-12-28
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#971](https://github.com/sebastianbergmann/php-code-coverage/issues/971): PHP report does not handle serialized code coverage data larger than 2 GB
|
||||
* [#974](https://github.com/sebastianbergmann/php-code-coverage/issues/974): Executable line analysis fails for declarations with enumerations and unions
|
||||
|
||||
## [9.2.22] - 2022-12-18
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#969](https://github.com/sebastianbergmann/php-code-coverage/pull/969): Fixed identifying line with `throw` as executable
|
||||
|
||||
## [9.2.21] - 2022-12-14
|
||||
|
||||
### Changed
|
||||
|
||||
* [#964](https://github.com/sebastianbergmann/php-code-coverage/pull/964): Changed how executable lines are identified
|
||||
|
||||
## [9.2.20] - 2022-12-13
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#960](https://github.com/sebastianbergmann/php-code-coverage/issues/960): New body font-size is way too big
|
||||
|
||||
## [9.2.19] - 2022-11-18
|
||||
|
||||
### Fixed
|
||||
@@ -433,6 +476,13 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* This component is no longer supported on PHP 7.1
|
||||
|
||||
[9.2.26]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.25...9.2.26
|
||||
[9.2.25]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.24...9.2.25
|
||||
[9.2.24]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.23...9.2.24
|
||||
[9.2.23]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.22...9.2.23
|
||||
[9.2.22]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.21...9.2.22
|
||||
[9.2.21]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.20...9.2.21
|
||||
[9.2.20]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.19...9.2.20
|
||||
[9.2.19]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.18...9.2.19
|
||||
[9.2.18]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.17...9.2.18
|
||||
[9.2.17]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.16...9.2.17
|
||||
+21
-25
@@ -1,33 +1,29 @@
|
||||
php-code-coverage
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2009-2022, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
Copyright (c) 2009-2023, Sebastian Bergmann
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Sebastian Bergmann nor the names of his
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
+3
-3
@@ -32,7 +32,7 @@
|
||||
"ext-dom": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"nikic/php-parser": "^4.14",
|
||||
"nikic/php-parser": "^4.15",
|
||||
"phpunit/php-file-iterator": "^3.0.3",
|
||||
"phpunit/php-text-template": "^2.0.2",
|
||||
"sebastian/code-unit-reverse-lookup": "^2.0.2",
|
||||
@@ -46,8 +46,8 @@
|
||||
"phpunit/phpunit": "^9.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-pcov": "*",
|
||||
"ext-xdebug": "*"
|
||||
"ext-pcov": "PHP extension that provides line coverage",
|
||||
"ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
||||
@@ -485,9 +485,16 @@ final class CodeCoverage
|
||||
continue;
|
||||
}
|
||||
|
||||
$linesToBranchMap = $this->analyser()->executableLinesIn($filename);
|
||||
|
||||
$data->keepLineCoverageDataOnlyForLines(
|
||||
$filename,
|
||||
$this->analyser()->executableLinesIn($filename)
|
||||
array_keys($linesToBranchMap)
|
||||
);
|
||||
|
||||
$data->markExecutableLineByBranch(
|
||||
$filename,
|
||||
$linesToBranchMap
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -643,7 +650,7 @@ final class CodeCoverage
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e->getCode(),
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ final class RawCodeCoverageData
|
||||
{
|
||||
$lineCoverage = [];
|
||||
|
||||
foreach ($analyser->executableLinesIn($filename) as $line) {
|
||||
foreach ($analyser->executableLinesIn($filename) as $line => $branch) {
|
||||
$lineCoverage[$line] = Driver::LINE_NOT_EXECUTED;
|
||||
}
|
||||
|
||||
@@ -141,6 +141,42 @@ final class RawCodeCoverageData
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $linesToBranchMap
|
||||
*/
|
||||
public function markExecutableLineByBranch(string $filename, array $linesToBranchMap): void
|
||||
{
|
||||
if (!isset($this->lineCoverage[$filename])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$linesByBranch = [];
|
||||
|
||||
foreach ($linesToBranchMap as $line => $branch) {
|
||||
$linesByBranch[$branch][] = $line;
|
||||
}
|
||||
|
||||
foreach ($this->lineCoverage[$filename] as $line => $lineStatus) {
|
||||
if (!isset($linesToBranchMap[$line])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$branch = $linesToBranchMap[$line];
|
||||
|
||||
if (!isset($linesByBranch[$branch])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($linesByBranch[$branch] as $lineInBranch) {
|
||||
$this->lineCoverage[$filename][$lineInBranch] = $lineStatus;
|
||||
}
|
||||
|
||||
if (Driver::LINE_EXECUTED === $lineStatus) {
|
||||
unset($linesByBranch[$branch]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $lines
|
||||
*/
|
||||
|
||||
@@ -134,7 +134,7 @@ final class File extends Renderer
|
||||
[
|
||||
'items' => $this->renderItems($node),
|
||||
'lines' => $this->renderSourceWithLineCoverage($node),
|
||||
'legend' => '<p><span class="success"><strong>Executed</strong></span><span class="danger"><strong>Not Executed</strong></span><span class="warning"><strong>Dead Code</strong></span></p>',
|
||||
'legend' => '<p><span class="legend covered-by-small-tests">Covered by small (and larger) tests</span><span class="legend covered-by-medium-tests">Covered by medium (and large) tests</span><span class="legend covered-by-large-tests">Covered by large tests (and tests of unknown size)</span><span class="legend not-covered">Not covered</span><span class="legend not-coverable">Not coverable</span></p>',
|
||||
'structure' => '',
|
||||
]
|
||||
);
|
||||
|
||||
+29
-1
@@ -1,6 +1,6 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 2em;
|
||||
font-size: 1em;
|
||||
font-kerning: normal;
|
||||
font-variant-ligatures: common-ligatures;
|
||||
text-rendering: optimizeLegibility;
|
||||
@@ -128,3 +128,31 @@ table + .structure-heading {
|
||||
border-top: 1px solid lightgrey;
|
||||
padding-top: 0.5em;
|
||||
}
|
||||
|
||||
.legend {
|
||||
font-weight: bold;
|
||||
margin-right: 2px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.covered-by-small-tests {
|
||||
background-color: #99cb84;
|
||||
}
|
||||
|
||||
.covered-by-medium-tests {
|
||||
background-color: #c3e3b5;
|
||||
}
|
||||
|
||||
.covered-by-large-tests {
|
||||
background-color: #dff0d8;
|
||||
}
|
||||
|
||||
.not-covered {
|
||||
background-color: #f2dede;
|
||||
}
|
||||
|
||||
.not-coverable {
|
||||
background-color: #fcf8e3;
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Dashboard for {{full_path}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/nv.d3.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/nv.d3.min.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -137,9 +137,9 @@
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="{{path_to_root}}_js/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/d3.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/nv.d3.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/jquery.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/d3.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/nv.d3.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
nv.addGraph(function() {
|
||||
|
||||
+6
-6
@@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Dashboard for {{full_path}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/nv.d3.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/nv.d3.min.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -137,9 +137,9 @@
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="{{path_to_root}}_js/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/d3.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/nv.d3.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/jquery.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/d3.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/nv.d3.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
nv.addGraph(function() {
|
||||
|
||||
Vendored
+3
-3
@@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Code Coverage for {{full_path}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/octicons.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/octicons.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Code Coverage for {{full_path}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/octicons.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/octicons.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+7
-7
@@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Code Coverage for {{full_path}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/octicons.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/octicons.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -57,9 +57,9 @@
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="{{path_to_root}}_js/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/popper.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/bootstrap.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/file.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/jquery.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/popper.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/bootstrap.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/file.js?v={{version}}" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Vendored
+7
-7
@@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Code Coverage for {{full_path}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/octicons.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/bootstrap.min.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/octicons.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/style.css?v={{version}}" rel="stylesheet" type="text/css">
|
||||
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -59,9 +59,9 @@
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="{{path_to_root}}_js/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/popper.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/bootstrap.min.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/file.js" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/jquery.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/popper.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/bootstrap.min.js?v={{version}}" type="text/javascript"></script>
|
||||
<script src="{{path_to_root}}_js/file.js?v={{version}}" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace SebastianBergmann\CodeCoverage\Report;
|
||||
use function dirname;
|
||||
use function file_put_contents;
|
||||
use function serialize;
|
||||
use function sprintf;
|
||||
use SebastianBergmann\CodeCoverage\CodeCoverage;
|
||||
use SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException;
|
||||
use SebastianBergmann\CodeCoverage\Util\Filesystem;
|
||||
@@ -21,14 +20,8 @@ final class PHP
|
||||
{
|
||||
public function process(CodeCoverage $coverage, ?string $target = null): string
|
||||
{
|
||||
$buffer = sprintf(
|
||||
"<?php
|
||||
return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'%s%s%sEND_OF_COVERAGE_SERIALIZATION%s);",
|
||||
PHP_EOL,
|
||||
serialize($coverage),
|
||||
PHP_EOL,
|
||||
PHP_EOL
|
||||
);
|
||||
$buffer = "<?php
|
||||
return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'" . PHP_EOL . serialize($coverage) . PHP_EOL . 'END_OF_COVERAGE_SERIALIZATION' . PHP_EOL . ');';
|
||||
|
||||
if ($target !== null) {
|
||||
Filesystem::createDirectory(dirname($target));
|
||||
|
||||
+38
-19
@@ -26,6 +26,7 @@ use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use PhpParser\Node\Stmt\Trait_;
|
||||
use PhpParser\Node\UnionType;
|
||||
use PhpParser\NodeAbstract;
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
use SebastianBergmann\Complexity\CyclomaticComplexityCalculatingVisitor;
|
||||
@@ -180,8 +181,12 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
|
||||
return '?' . $type->type;
|
||||
}
|
||||
|
||||
if ($type instanceof UnionType || $type instanceof IntersectionType) {
|
||||
return $this->unionOrIntersectionAsString($type);
|
||||
if ($type instanceof UnionType) {
|
||||
return $this->unionTypeAsString($type);
|
||||
}
|
||||
|
||||
if ($type instanceof IntersectionType) {
|
||||
return $this->intersectionTypeAsString($type);
|
||||
}
|
||||
|
||||
return $type->toString();
|
||||
@@ -298,29 +303,43 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
|
||||
return trim(rtrim($namespacedName, $name), '\\');
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param UnionType|IntersectionType $type
|
||||
*/
|
||||
private function unionOrIntersectionAsString(ComplexType $type): string
|
||||
private function unionTypeAsString(UnionType $node): string
|
||||
{
|
||||
if ($type instanceof UnionType) {
|
||||
$separator = '|';
|
||||
} else {
|
||||
$separator = '&';
|
||||
}
|
||||
|
||||
$types = [];
|
||||
|
||||
foreach ($type->types as $_type) {
|
||||
if ($_type instanceof Name) {
|
||||
$types[] = $_type->toCodeString();
|
||||
} else {
|
||||
assert($_type instanceof Identifier);
|
||||
foreach ($node->types as $type) {
|
||||
if ($type instanceof IntersectionType) {
|
||||
$types[] = '(' . $this->intersectionTypeAsString($type) . ')';
|
||||
|
||||
$types[] = $_type->toString();
|
||||
continue;
|
||||
}
|
||||
|
||||
$types[] = $this->typeAsString($type);
|
||||
}
|
||||
|
||||
return implode($separator, $types);
|
||||
return implode('|', $types);
|
||||
}
|
||||
|
||||
private function intersectionTypeAsString(IntersectionType $node): string
|
||||
{
|
||||
$types = [];
|
||||
|
||||
foreach ($node->types as $type) {
|
||||
$types[] = $this->typeAsString($type);
|
||||
}
|
||||
|
||||
return implode('&', $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param Identifier|Name $node $node
|
||||
*/
|
||||
private function typeAsString(NodeAbstract $node): string
|
||||
{
|
||||
if ($node instanceof Name) {
|
||||
return $node->toCodeString();
|
||||
}
|
||||
|
||||
return $node->toString();
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+317
-285
@@ -9,46 +9,19 @@
|
||||
*/
|
||||
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;
|
||||
|
||||
use function array_reverse;
|
||||
use function array_diff_key;
|
||||
use function assert;
|
||||
use function count;
|
||||
use function current;
|
||||
use function end;
|
||||
use function explode;
|
||||
use function max;
|
||||
use function preg_match;
|
||||
use function preg_quote;
|
||||
use function range;
|
||||
use function sort;
|
||||
use function reset;
|
||||
use function sprintf;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
use PhpParser\Node\Expr\CallLike;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\Match_;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\NullsafePropertyFetch;
|
||||
use PhpParser\Node\Expr\Print_;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||
use PhpParser\Node\Expr\Ternary;
|
||||
use PhpParser\Node\MatchArm;
|
||||
use PhpParser\Node\Scalar\Encapsed;
|
||||
use PhpParser\Node\Stmt\Break_;
|
||||
use PhpParser\Node\Stmt\Case_;
|
||||
use PhpParser\Node\Stmt\Catch_;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Continue_;
|
||||
use PhpParser\Node\Stmt\Do_;
|
||||
use PhpParser\Node\Stmt\Echo_;
|
||||
use PhpParser\Node\Stmt\ElseIf_;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\For_;
|
||||
use PhpParser\Node\Stmt\Foreach_;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\Goto_;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use PhpParser\Node\Stmt\Throw_;
|
||||
use PhpParser\Node\Stmt\Unset_;
|
||||
use PhpParser\Node\Stmt\While_;
|
||||
use PhpParser\NodeAbstract;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
|
||||
/**
|
||||
@@ -57,285 +30,344 @@ use PhpParser\NodeVisitorAbstract;
|
||||
final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
|
||||
{
|
||||
/**
|
||||
* @psalm-var array<int, int>
|
||||
* @var int
|
||||
*/
|
||||
private $executableLines = [];
|
||||
private $nextBranch = 0;
|
||||
|
||||
/**
|
||||
* @psalm-var array<int, int>
|
||||
* @var string
|
||||
*/
|
||||
private $propertyLines = [];
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* @psalm-var array<int, Function_|ClassMethod|Return_|Expression|Assign|Array_>
|
||||
* @var array<int, int>
|
||||
*/
|
||||
private $returns = [];
|
||||
private $executableLinesGroupedByBranch = [];
|
||||
|
||||
/**
|
||||
* @var array<int, bool>
|
||||
*/
|
||||
private $unsets = [];
|
||||
|
||||
/**
|
||||
* @var array<int, string>
|
||||
*/
|
||||
private $commentsToCheckForUnset = [];
|
||||
|
||||
public function __construct(string $source)
|
||||
{
|
||||
$this->source = $source;
|
||||
}
|
||||
|
||||
public function enterNode(Node $node): void
|
||||
{
|
||||
if (!$node instanceof NodeAbstract) {
|
||||
foreach ($node->getComments() as $comment) {
|
||||
$commentLine = $comment->getStartLine();
|
||||
|
||||
if (!isset($this->executableLinesGroupedByBranch[$commentLine])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (explode("\n", $comment->getText()) as $text) {
|
||||
$this->commentsToCheckForUnset[$commentLine] = $text;
|
||||
$commentLine++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Scalar\String_ ||
|
||||
$node instanceof Node\Scalar\EncapsedStringPart) {
|
||||
$startLine = $node->getStartLine() + 1;
|
||||
$endLine = $node->getEndLine() - 1;
|
||||
|
||||
if ($startLine <= $endLine) {
|
||||
foreach (range($startLine, $endLine) as $line) {
|
||||
unset($this->executableLinesGroupedByBranch[$line]);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->savePropertyLines($node);
|
||||
if ($node instanceof Node\Stmt\Interface_) {
|
||||
foreach (range($node->getStartLine(), $node->getEndLine()) as $line) {
|
||||
$this->unsets[$line] = true;
|
||||
}
|
||||
|
||||
if (!$this->isExecutable($node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->getLines($node, false) as $line) {
|
||||
if (isset($this->propertyLines[$line])) {
|
||||
if ($node instanceof Node\Stmt\Declare_ ||
|
||||
$node instanceof Node\Stmt\DeclareDeclare ||
|
||||
$node instanceof Node\Stmt\Else_ ||
|
||||
$node instanceof Node\Stmt\EnumCase ||
|
||||
$node instanceof Node\Stmt\Finally_ ||
|
||||
$node instanceof Node\Stmt\Label ||
|
||||
$node instanceof Node\Stmt\Namespace_ ||
|
||||
$node instanceof Node\Stmt\Nop ||
|
||||
$node instanceof Node\Stmt\Switch_ ||
|
||||
$node instanceof Node\Stmt\TryCatch ||
|
||||
$node instanceof Node\Stmt\Use_ ||
|
||||
$node instanceof Node\Stmt\UseUse ||
|
||||
$node instanceof Node\Expr\ConstFetch ||
|
||||
$node instanceof Node\Expr\Match_ ||
|
||||
$node instanceof Node\Expr\Variable ||
|
||||
$node instanceof Node\ComplexType ||
|
||||
$node instanceof Node\Const_ ||
|
||||
$node instanceof Node\Identifier ||
|
||||
$node instanceof Node\Name ||
|
||||
$node instanceof Node\Param ||
|
||||
$node instanceof Node\Scalar) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Stmt\Throw_) {
|
||||
$this->setLineBranch($node->expr->getEndLine(), $node->expr->getEndLine(), ++$this->nextBranch);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Stmt\Enum_ ||
|
||||
$node instanceof Node\Stmt\Function_ ||
|
||||
$node instanceof Node\Stmt\Class_ ||
|
||||
$node instanceof Node\Stmt\ClassMethod ||
|
||||
$node instanceof Node\Expr\Closure ||
|
||||
$node instanceof Node\Stmt\Trait_) {
|
||||
$isConcreteClassLike = $node instanceof Node\Stmt\Enum_ || $node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Trait_;
|
||||
|
||||
if (null !== $node->stmts) {
|
||||
foreach ($node->stmts as $stmt) {
|
||||
if ($stmt instanceof Node\Stmt\Nop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (range($stmt->getStartLine(), $stmt->getEndLine()) as $line) {
|
||||
unset($this->executableLinesGroupedByBranch[$line]);
|
||||
|
||||
if (
|
||||
$isConcreteClassLike &&
|
||||
!$stmt instanceof Node\Stmt\ClassMethod
|
||||
) {
|
||||
$this->unsets[$line] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($isConcreteClassLike) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->executableLines[$line] = $line;
|
||||
$hasEmptyBody = [] === $node->stmts ||
|
||||
null === $node->stmts ||
|
||||
(
|
||||
1 === count($node->stmts) &&
|
||||
$node->stmts[0] instanceof Node\Stmt\Nop
|
||||
);
|
||||
|
||||
if ($hasEmptyBody) {
|
||||
if ($node->getEndLine() === $node->getStartLine()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setLineBranch($node->getEndLine(), $node->getEndLine(), ++$this->nextBranch);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Expr\ArrowFunction) {
|
||||
$startLine = max(
|
||||
$node->getStartLine() + 1,
|
||||
$node->expr->getStartLine()
|
||||
);
|
||||
|
||||
$endLine = $node->expr->getEndLine();
|
||||
|
||||
if ($endLine < $startLine) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setLineBranch($startLine, $endLine, ++$this->nextBranch);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Expr\Ternary) {
|
||||
if (null !== $node->if &&
|
||||
$node->getStartLine() !== $node->if->getEndLine()) {
|
||||
$this->setLineBranch($node->if->getStartLine(), $node->if->getEndLine(), ++$this->nextBranch);
|
||||
}
|
||||
|
||||
if ($node->getStartLine() !== $node->else->getEndLine()) {
|
||||
$this->setLineBranch($node->else->getStartLine(), $node->else->getEndLine(), ++$this->nextBranch);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Expr\BinaryOp\Coalesce) {
|
||||
if ($node->getStartLine() !== $node->getEndLine()) {
|
||||
$this->setLineBranch($node->getEndLine(), $node->getEndLine(), ++$this->nextBranch);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Stmt\If_ ||
|
||||
$node instanceof Node\Stmt\ElseIf_ ||
|
||||
$node instanceof Node\Stmt\Case_) {
|
||||
if (null === $node->cond) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setLineBranch(
|
||||
$node->cond->getStartLine(),
|
||||
$node->cond->getStartLine(),
|
||||
++$this->nextBranch
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Stmt\For_) {
|
||||
$startLine = null;
|
||||
$endLine = null;
|
||||
|
||||
if ([] !== $node->init) {
|
||||
$startLine = $node->init[0]->getStartLine();
|
||||
|
||||
end($node->init);
|
||||
|
||||
$endLine = current($node->init)->getEndLine();
|
||||
|
||||
reset($node->init);
|
||||
}
|
||||
|
||||
if ([] !== $node->cond) {
|
||||
if (null === $startLine) {
|
||||
$startLine = $node->cond[0]->getStartLine();
|
||||
}
|
||||
|
||||
end($node->cond);
|
||||
|
||||
$endLine = current($node->cond)->getEndLine();
|
||||
|
||||
reset($node->cond);
|
||||
}
|
||||
|
||||
if ([] !== $node->loop) {
|
||||
if (null === $startLine) {
|
||||
$startLine = $node->loop[0]->getStartLine();
|
||||
}
|
||||
|
||||
end($node->loop);
|
||||
|
||||
$endLine = current($node->loop)->getEndLine();
|
||||
|
||||
reset($node->loop);
|
||||
}
|
||||
|
||||
if (null === $startLine || null === $endLine) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setLineBranch(
|
||||
$startLine,
|
||||
$endLine,
|
||||
++$this->nextBranch
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Stmt\Foreach_) {
|
||||
$this->setLineBranch(
|
||||
$node->expr->getStartLine(),
|
||||
$node->valueVar->getEndLine(),
|
||||
++$this->nextBranch
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Stmt\While_ ||
|
||||
$node instanceof Node\Stmt\Do_) {
|
||||
$this->setLineBranch(
|
||||
$node->cond->getStartLine(),
|
||||
$node->cond->getEndLine(),
|
||||
++$this->nextBranch
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Stmt\Catch_) {
|
||||
assert([] !== $node->types);
|
||||
$startLine = $node->types[0]->getStartLine();
|
||||
end($node->types);
|
||||
$endLine = current($node->types)->getEndLine();
|
||||
|
||||
$this->setLineBranch(
|
||||
$startLine,
|
||||
$endLine,
|
||||
++$this->nextBranch
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Expr\CallLike) {
|
||||
if (isset($this->executableLinesGroupedByBranch[$node->getStartLine()])) {
|
||||
$branch = $this->executableLinesGroupedByBranch[$node->getStartLine()];
|
||||
} else {
|
||||
$branch = ++$this->nextBranch;
|
||||
}
|
||||
|
||||
$this->setLineBranch($node->getStartLine(), $node->getEndLine(), $branch);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($this->executableLinesGroupedByBranch[$node->getStartLine()])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setLineBranch($node->getStartLine(), $node->getEndLine(), ++$this->nextBranch);
|
||||
}
|
||||
|
||||
public function afterTraverse(array $nodes): void
|
||||
{
|
||||
$this->computeReturns();
|
||||
$lines = explode("\n", $this->source);
|
||||
|
||||
sort($this->executableLines);
|
||||
foreach ($lines as $lineNumber => $line) {
|
||||
$lineNumber++;
|
||||
|
||||
if (1 === preg_match('/^\s*$/', $line) ||
|
||||
(
|
||||
isset($this->commentsToCheckForUnset[$lineNumber]) &&
|
||||
1 === preg_match(sprintf('/^\s*%s\s*$/', preg_quote($this->commentsToCheckForUnset[$lineNumber], '/')), $line)
|
||||
)) {
|
||||
unset($this->executableLinesGroupedByBranch[$lineNumber]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->executableLinesGroupedByBranch = array_diff_key(
|
||||
$this->executableLinesGroupedByBranch,
|
||||
$this->unsets
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-return array<int, int>
|
||||
*/
|
||||
public function executableLines(): array
|
||||
public function executableLinesGroupedByBranch(): array
|
||||
{
|
||||
return $this->executableLines;
|
||||
return $this->executableLinesGroupedByBranch;
|
||||
}
|
||||
|
||||
private function savePropertyLines(Node $node): void
|
||||
private function setLineBranch(int $start, int $end, int $branch): void
|
||||
{
|
||||
if ($node instanceof Property) {
|
||||
foreach (range($node->getStartLine(), $node->getEndLine()) as $index) {
|
||||
$this->propertyLines[$index] = $index;
|
||||
}
|
||||
foreach (range($start, $end) as $line) {
|
||||
$this->executableLinesGroupedByBranch[$line] = $branch;
|
||||
}
|
||||
}
|
||||
|
||||
private function computeReturns(): void
|
||||
{
|
||||
foreach (array_reverse($this->returns) as $node) {
|
||||
foreach (range($node->getStartLine(), $node->getEndLine()) as $index) {
|
||||
if (isset($this->executableLines[$index])) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getLines($node, true) as $line) {
|
||||
$this->executableLines[$line] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int[]
|
||||
*/
|
||||
private function getLines(NodeAbstract $node, bool $fromReturns): array
|
||||
{
|
||||
if ($node instanceof Function_ ||
|
||||
$node instanceof ClassMethod ||
|
||||
$node instanceof Return_ ||
|
||||
$node instanceof Expression ||
|
||||
$node instanceof Assign ||
|
||||
$node instanceof Array_
|
||||
) {
|
||||
if (!$fromReturns) {
|
||||
$this->returns[] = $node;
|
||||
|
||||
if ($node instanceof ClassMethod && $node->name->name === '__construct') {
|
||||
$existsAPromotedProperty = false;
|
||||
|
||||
foreach ($node->getParams() as $param) {
|
||||
if (0 !== ($param->flags & Class_::VISIBILITY_MODIFIER_MASK)) {
|
||||
$existsAPromotedProperty = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($existsAPromotedProperty) {
|
||||
// Only the line with `function` keyword should be listed here
|
||||
// but `nikic/php-parser` doesn't provide a way to fetch it
|
||||
return range($node->getStartLine(), $node->name->getEndLine());
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
// ugly fix for non-fully AST based processing
|
||||
// self::afterTraverse()/self::computeReturns() should be rewritten using self::leaveNode()
|
||||
foreach (range($node->getStartLine(), $node->getEndLine()) as $index) {
|
||||
if (isset($this->executableLines[$index]) && !($node instanceof Assign)) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// empty function
|
||||
if ($node instanceof Function_) {
|
||||
return [$node->getEndLine()];
|
||||
}
|
||||
|
||||
// empty method
|
||||
if ($node instanceof ClassMethod) {
|
||||
if (null === $node->stmts) { // method without body (interface prototype)
|
||||
return [];
|
||||
}
|
||||
|
||||
return [$node->getEndLine()];
|
||||
}
|
||||
}
|
||||
|
||||
if ($node instanceof Return_) {
|
||||
if ($node->expr === null) {
|
||||
return [$node->getEndLine()];
|
||||
}
|
||||
|
||||
return $this->getLines($node->expr, $fromReturns);
|
||||
}
|
||||
|
||||
if ($node instanceof Expression) {
|
||||
return $this->getLines($node->expr, $fromReturns);
|
||||
}
|
||||
|
||||
if ($node instanceof Assign) {
|
||||
return [$this->getNodeStartLine($node->var)];
|
||||
}
|
||||
|
||||
if ($node instanceof BinaryOp) {
|
||||
return $fromReturns ? $this->getLines($node->right, $fromReturns) : [];
|
||||
}
|
||||
|
||||
if ($node instanceof PropertyFetch ||
|
||||
$node instanceof NullsafePropertyFetch ||
|
||||
$node instanceof StaticPropertyFetch) {
|
||||
return [$this->getNodeStartLine($node->name)];
|
||||
}
|
||||
|
||||
if ($node instanceof ArrayDimFetch && null !== $node->dim) {
|
||||
return [$this->getNodeStartLine($node->dim)];
|
||||
}
|
||||
|
||||
if ($node instanceof MethodCall) {
|
||||
return [$this->getNodeStartLine($node->name)];
|
||||
}
|
||||
|
||||
if ($node instanceof Ternary) {
|
||||
$lines = [$this->getNodeStartLine($node->cond)];
|
||||
|
||||
if (null !== $node->if) {
|
||||
$lines[] = $this->getNodeStartLine($node->if);
|
||||
}
|
||||
|
||||
$lines[] = $this->getNodeStartLine($node->else);
|
||||
|
||||
return $lines;
|
||||
}
|
||||
|
||||
if ($node instanceof Match_) {
|
||||
return [$this->getNodeStartLine($node->cond)];
|
||||
}
|
||||
|
||||
if ($node instanceof MatchArm) {
|
||||
return [$this->getNodeStartLine($node->body)];
|
||||
}
|
||||
|
||||
// TODO this concept should be extended for every statement class like Foreach_, For_, ...
|
||||
if ($node instanceof If_ ||
|
||||
$node instanceof ElseIf_ ||
|
||||
$node instanceof While_ ||
|
||||
$node instanceof Do_) {
|
||||
return [$this->getNodeStartLine($node->cond)];
|
||||
}
|
||||
|
||||
if ($node instanceof Case_) {
|
||||
if (null === $node->cond) { // default case
|
||||
return [];
|
||||
}
|
||||
|
||||
return [$this->getNodeStartLine($node->cond)];
|
||||
}
|
||||
|
||||
if ($node instanceof Catch_) {
|
||||
return [$this->getNodeStartLine($node->types[0])];
|
||||
}
|
||||
|
||||
return [$this->getNodeStartLine($node)];
|
||||
}
|
||||
|
||||
private function getNodeStartLine(NodeAbstract $node): int
|
||||
{
|
||||
if ($node instanceof Node\Expr\Cast ||
|
||||
$node instanceof Node\Expr\BooleanNot ||
|
||||
$node instanceof Node\Expr\UnaryMinus ||
|
||||
$node instanceof Node\Expr\UnaryPlus
|
||||
) {
|
||||
return $this->getNodeStartLine($node->expr);
|
||||
}
|
||||
|
||||
if ($node instanceof BinaryOp) {
|
||||
return $this->getNodeStartLine($node->right);
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Scalar\String_ && (
|
||||
$node->getAttribute('kind') === Node\Scalar\String_::KIND_HEREDOC ||
|
||||
$node->getAttribute('kind') === Node\Scalar\String_::KIND_NOWDOC
|
||||
)) {
|
||||
return $node->getStartLine() + 1;
|
||||
}
|
||||
|
||||
if ($node instanceof Array_) {
|
||||
if ([] === $node->items || $node->items[0] === null) {
|
||||
return $node->getEndLine();
|
||||
}
|
||||
|
||||
return $this->getNodeStartLine($node->items[0]->value);
|
||||
}
|
||||
|
||||
if ($node instanceof Assign) {
|
||||
return $this->getNodeStartLine($node->expr);
|
||||
}
|
||||
|
||||
return $node->getStartLine(); // $node should be only a scalar here
|
||||
}
|
||||
|
||||
private function isExecutable(Node $node): bool
|
||||
{
|
||||
return $node instanceof Assign ||
|
||||
$node instanceof ArrayDimFetch ||
|
||||
$node instanceof BinaryOp ||
|
||||
$node instanceof Break_ ||
|
||||
$node instanceof CallLike ||
|
||||
$node instanceof Case_ ||
|
||||
$node instanceof Catch_ ||
|
||||
$node instanceof ClassMethod ||
|
||||
$node instanceof Closure ||
|
||||
$node instanceof Continue_ ||
|
||||
$node instanceof Do_ ||
|
||||
$node instanceof Echo_ ||
|
||||
$node instanceof ElseIf_ ||
|
||||
$node instanceof Encapsed ||
|
||||
$node instanceof Expression ||
|
||||
$node instanceof For_ ||
|
||||
$node instanceof Foreach_ ||
|
||||
$node instanceof Function_ ||
|
||||
$node instanceof Goto_ ||
|
||||
$node instanceof If_ ||
|
||||
$node instanceof Match_ ||
|
||||
$node instanceof MatchArm ||
|
||||
$node instanceof MethodCall ||
|
||||
$node instanceof NullsafePropertyFetch ||
|
||||
$node instanceof Print_ ||
|
||||
$node instanceof PropertyFetch ||
|
||||
$node instanceof Return_ ||
|
||||
$node instanceof StaticPropertyFetch ||
|
||||
$node instanceof Ternary ||
|
||||
$node instanceof Throw_ ||
|
||||
$node instanceof Unset_ ||
|
||||
$node instanceof While_;
|
||||
}
|
||||
}
|
||||
|
||||
+33
-33
@@ -15,6 +15,7 @@ use function assert;
|
||||
use function file_get_contents;
|
||||
use function is_array;
|
||||
use function max;
|
||||
use function range;
|
||||
use function sort;
|
||||
use function sprintf;
|
||||
use function substr_count;
|
||||
@@ -155,7 +156,7 @@ final class ParsingFileAnalyser implements FileAnalyser
|
||||
$codeUnitFindingVisitor = new CodeUnitFindingVisitor;
|
||||
$lineCountingVisitor = new LineCountingVisitor($linesOfCode);
|
||||
$ignoredLinesFindingVisitor = new IgnoredLinesFindingVisitor($this->useAnnotationsForIgnoringCode, $this->ignoreDeprecatedCode);
|
||||
$executableLinesFindingVisitor = new ExecutableLinesFindingVisitor;
|
||||
$executableLinesFindingVisitor = new ExecutableLinesFindingVisitor($source);
|
||||
|
||||
$traverser->addVisitor(new NameResolver);
|
||||
$traverser->addVisitor(new ParentConnectingVisitor);
|
||||
@@ -174,7 +175,7 @@ final class ParsingFileAnalyser implements FileAnalyser
|
||||
$filename,
|
||||
$error->getMessage()
|
||||
),
|
||||
(int) $error->getCode(),
|
||||
$error->getCode(),
|
||||
$error
|
||||
);
|
||||
}
|
||||
@@ -183,7 +184,7 @@ final class ParsingFileAnalyser implements FileAnalyser
|
||||
$this->classes[$filename] = $codeUnitFindingVisitor->classes();
|
||||
$this->traits[$filename] = $codeUnitFindingVisitor->traits();
|
||||
$this->functions[$filename] = $codeUnitFindingVisitor->functions();
|
||||
$this->executableLines[$filename] = $executableLinesFindingVisitor->executableLines();
|
||||
$this->executableLines[$filename] = $executableLinesFindingVisitor->executableLinesGroupedByBranch();
|
||||
$this->ignoredLines[$filename] = [];
|
||||
|
||||
$this->findLinesIgnoredByLineBasedAnnotations($filename, $source, $this->useAnnotationsForIgnoringCode);
|
||||
@@ -208,45 +209,44 @@ final class ParsingFileAnalyser implements FileAnalyser
|
||||
|
||||
private function findLinesIgnoredByLineBasedAnnotations(string $filename, string $source, bool $useAnnotationsForIgnoringCode): void
|
||||
{
|
||||
$ignore = false;
|
||||
$stop = false;
|
||||
if (!$useAnnotationsForIgnoringCode) {
|
||||
return;
|
||||
}
|
||||
|
||||
$start = false;
|
||||
|
||||
foreach (token_get_all($source) as $token) {
|
||||
if (!is_array($token)) {
|
||||
if (!is_array($token) ||
|
||||
!(T_COMMENT === $token[0] || T_DOC_COMMENT === $token[0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($token[0]) {
|
||||
case T_COMMENT:
|
||||
case T_DOC_COMMENT:
|
||||
if (!$useAnnotationsForIgnoringCode) {
|
||||
break;
|
||||
}
|
||||
$comment = trim($token[1]);
|
||||
|
||||
$comment = trim($token[1]);
|
||||
|
||||
if ($comment === '// @codeCoverageIgnore' ||
|
||||
$comment === '//@codeCoverageIgnore') {
|
||||
$ignore = true;
|
||||
$stop = true;
|
||||
} elseif ($comment === '// @codeCoverageIgnoreStart' ||
|
||||
$comment === '//@codeCoverageIgnoreStart') {
|
||||
$ignore = true;
|
||||
} elseif ($comment === '// @codeCoverageIgnoreEnd' ||
|
||||
$comment === '//@codeCoverageIgnoreEnd') {
|
||||
$stop = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($ignore) {
|
||||
if ($comment === '// @codeCoverageIgnore' ||
|
||||
$comment === '//@codeCoverageIgnore') {
|
||||
$this->ignoredLines[$filename][] = $token[2];
|
||||
|
||||
if ($stop) {
|
||||
$ignore = false;
|
||||
$stop = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($comment === '// @codeCoverageIgnoreStart' ||
|
||||
$comment === '//@codeCoverageIgnoreStart') {
|
||||
$start = $token[2];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($comment === '// @codeCoverageIgnoreEnd' ||
|
||||
$comment === '//@codeCoverageIgnoreEnd') {
|
||||
if (false === $start) {
|
||||
$start = $token[2];
|
||||
}
|
||||
|
||||
$this->ignoredLines[$filename] = array_merge(
|
||||
$this->ignoredLines[$filename],
|
||||
range($start, $token[2])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ final class Version
|
||||
public static function id(): string
|
||||
{
|
||||
if (self::$version === null) {
|
||||
self::$version = (new VersionId('9.2.19', dirname(__DIR__)))->getVersion();
|
||||
self::$version = (new VersionId('9.2.26', dirname(__DIR__)))->getVersion();
|
||||
}
|
||||
|
||||
return self::$version;
|
||||
|
||||
-290
@@ -1,290 +0,0 @@
|
||||
# Changes in PHPUnit 8.5
|
||||
|
||||
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.31] - 2022-10-28
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5076](https://github.com/sebastianbergmann/phpunit/issues/5076): Test Runner does not warn about conflicting options
|
||||
|
||||
## [8.5.30] - 2022-09-25
|
||||
|
||||
### Changed
|
||||
|
||||
* The configuration generator now asks for a cache directory
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4913](https://github.com/sebastianbergmann/phpunit/issues/4913): Failed `assert()` should show a backtrace
|
||||
* [#4966](https://github.com/sebastianbergmann/phpunit/issues/4966): `TestCase::assertSame()` (and related exact comparisons) must compare `float` exactly
|
||||
|
||||
## [8.5.29] - 2022-08-22
|
||||
|
||||
### Changed
|
||||
|
||||
* [#5033](https://github.com/sebastianbergmann/phpunit/issues/5033): Do not depend on phpspec/prophecy
|
||||
|
||||
## [8.5.28] - 2022-07-29
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5015](https://github.com/sebastianbergmann/phpunit/pull/5015): Ukraine banner unreadable on black background
|
||||
* [#5016](https://github.com/sebastianbergmann/phpunit/issues/5016): PHPUnit 8.5.27 does not work on PHP 7.2.0-7.2.18 and PHP 7.3.0-7.3.5
|
||||
|
||||
## [8.5.27] - 2022-06-19
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4950](https://github.com/sebastianbergmann/phpunit/issues/4950): False error on `atMost()` invocation rule without call
|
||||
* [#4962](https://github.com/sebastianbergmann/phpunit/issues/4962): Ukraine banner unreadable on white background
|
||||
|
||||
## [8.5.26] - 2022-04-01
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4938](https://github.com/sebastianbergmann/phpunit/issues/4938): Test Double code generator does not handle `void` return type declaration on `__clone()` methods
|
||||
|
||||
## [8.5.25] - 2022-03-16
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4934](https://github.com/sebastianbergmann/phpunit/issues/4934): Code Coverage does not work with PHPUnit 8.5.24 PHAR on PHP 7
|
||||
|
||||
## [8.5.24] - 2022-03-05 - #StandWithUkraine
|
||||
|
||||
### 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
|
||||
|
||||
* [#4812](https://github.com/sebastianbergmann/phpunit/issues/4812): Do not enforce time limits when a debugging session through DBGp is active
|
||||
* [#4835](https://github.com/sebastianbergmann/phpunit/issues/4835): Support for `$GLOBALS['_composer_autoload_path']` introduced in Composer 2.2
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4840](https://github.com/sebastianbergmann/phpunit/pull/4840): TestDox prettifying for class names does not correctly handle diacritics
|
||||
* [#4846](https://github.com/sebastianbergmann/phpunit/pull/4846): Composer proxy script is not ignored
|
||||
|
||||
## [8.5.21] - 2021-09-25
|
||||
|
||||
### Changed
|
||||
|
||||
* PHPUnit no longer converts PHP deprecations to exceptions by default (configure `convertDeprecationsToExceptions="true"` to enable this)
|
||||
* The PHPUnit XML configuration file generator now configures `convertDeprecationsToExceptions="true"`
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4772](https://github.com/sebastianbergmann/phpunit/pull/4772): TestDox HTML report not displayed correctly when browser has custom colour settings
|
||||
|
||||
## [8.5.20] - 2021-08-31
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4751](https://github.com/sebastianbergmann/phpunit/issues/4751): Configuration validation fails when using brackets in glob pattern
|
||||
|
||||
## [8.5.19] - 2021-07-31
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4740](https://github.com/sebastianbergmann/phpunit/issues/4740): `phpunit.phar` does not work with PHP 8.1
|
||||
|
||||
## [8.5.18] - 2021-07-19
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4720](https://github.com/sebastianbergmann/phpunit/issues/4720): PHPUnit does not verify its own PHP extension requirements
|
||||
|
||||
## [8.5.17] - 2021-06-23
|
||||
|
||||
### Changed
|
||||
|
||||
* PHPUnit now errors out on startup when `PHP_VERSION` contains a value that is not compatible with `version_compare()`, for instance `X.Y.Z-(to be removed in future macOS)`
|
||||
|
||||
## [8.5.16] - 2021-06-05
|
||||
|
||||
### Changed
|
||||
|
||||
* The test result cache (the storage for which is implemented in `PHPUnit\Runner\DefaultTestResultCache`) no longer uses PHP's `serialize()` and `unserialize()` functions for persistence. It now uses a versioned JSON format instead that is independent of PHP implementation details (see [#3581](https://github.com/sebastianbergmann/phpunit/issues/3581) and [#4662](https://github.com/sebastianbergmann/phpunit/pull/4662) for examples why this is a problem). When PHPUnit tries to load the test result cache from a file that does not exist, or from a file that does not contain data in JSON format, or from a file that contains data in a JSON format version other than the one used by the currently running PHPUnit version, then this is considered to be a "cache miss". An empty `DefaultTestResultCache` object is created in this case. This should also prevent PHPUnit from crashing when trying to load a test result cache file created by a different version of PHPUnit (see [#4580](https://github.com/sebastianbergmann/phpunit/issues/4580) for example).
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4663](https://github.com/sebastianbergmann/phpunit/issues/4663): `TestCase::expectError()` works on PHP 7.3, but not on PHP >= 7.4
|
||||
* [#4678](https://github.com/sebastianbergmann/phpunit/pull/4678): Stubbed methods with `iterable` return types should return empty array by default
|
||||
* [#4692](https://github.com/sebastianbergmann/phpunit/issues/4692): Annotations in single-line doc-comments are not handled correctly
|
||||
* [#4694](https://github.com/sebastianbergmann/phpunit/issues/4694): `TestCase::getMockFromWsdl()` does not work with PHP 8.1-dev
|
||||
|
||||
## [8.5.15] - 2021-03-17
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4591](https://github.com/sebastianbergmann/phpunit/issues/4591): TeamCity logger logs warnings as test failures
|
||||
|
||||
## [8.5.14] - 2021-01-17
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly
|
||||
* [#4572](https://github.com/sebastianbergmann/phpunit/issues/4572): Schema validation does not work with `%xx` sequences in path to `phpunit.xsd`
|
||||
* [#4575](https://github.com/sebastianbergmann/phpunit/issues/4575): PHPUnit 8.5 incompatibility with PHP 8.1
|
||||
|
||||
## [8.5.13] - 2020-12-01
|
||||
|
||||
### Fixed
|
||||
|
||||
* Running tests in isolated processes did not work with PHP 8 on Windows
|
||||
|
||||
## [8.5.12] - 2020-11-30
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed PHP version constraint in `composer.json` from `^7.2` to `>=7.2` to allow the installation of PHPUnit 8.5 on PHP 8. Please note that the code coverage functionality is not available for PHPUnit 8.5 on PHP 8.
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4529](https://github.com/sebastianbergmann/phpunit/issues/4529): Debug mode of Xdebug 2 is not disabled for PHPT tests
|
||||
|
||||
## [8.5.11] - 2020-11-27
|
||||
|
||||
### Changed
|
||||
|
||||
* Bumped required version of `phpunit/php-code-coverage`
|
||||
|
||||
## [8.5.10] - 2020-11-27
|
||||
|
||||
### Added
|
||||
|
||||
* Support for Xdebug 3
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4516](https://github.com/sebastianbergmann/phpunit/issues/4516): `phpunit/phpunit-selenium` does not work with PHPUnit 8.5.9
|
||||
|
||||
## [8.5.9] - 2020-11-10
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#3965](https://github.com/sebastianbergmann/phpunit/issues/3965): Process Isolation throws exceptions when PHPDBG is used
|
||||
* [#4470](https://github.com/sebastianbergmann/phpunit/pull/4470): Infinite recursion when `--static-backup --strict-global-state` is used
|
||||
|
||||
## [8.5.8] - 2020-06-22
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4312](https://github.com/sebastianbergmann/phpunit/issues/4312): Fix for [#4299](https://github.com/sebastianbergmann/phpunit/issues/4299) breaks backward compatibility
|
||||
|
||||
## [8.5.7] - 2020-06-21
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4299](https://github.com/sebastianbergmann/phpunit/issues/4299): "No tests executed" does not always result in exit code `1`
|
||||
* [#4306](https://github.com/sebastianbergmann/phpunit/issues/4306): Exceptions during code coverage driver initialization are not handled correctly
|
||||
|
||||
## [8.5.6] - 2020-06-15
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4211](https://github.com/sebastianbergmann/phpunit/issues/4211): `phpdbg_*()` functions are scoped to `PHPUnit\phpdbg_*()`
|
||||
|
||||
## [8.5.5] - 2020-05-22
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4033](https://github.com/sebastianbergmann/phpunit/issues/4033): Unexpected behaviour when `$GLOBALS` is deleted
|
||||
|
||||
## [8.5.4] - 2020-04-23
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed how `PHPUnit\TextUI\Command` passes warnings to `PHPUnit\TextUI\TestRunner`
|
||||
|
||||
## [8.5.3] - 2020-03-31
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4017](https://github.com/sebastianbergmann/phpunit/issues/4017): Do not suggest refactoring to something that is also deprecated
|
||||
* [#4133](https://github.com/sebastianbergmann/phpunit/issues/4133): `expectExceptionMessageRegExp()` has been removed in PHPUnit 9 without a deprecation warning being given in PHPUnit 8
|
||||
* [#4139](https://github.com/sebastianbergmann/phpunit/issues/4139): Cannot double interfaces that declare a constructor with PHP 8
|
||||
* [#4144](https://github.com/sebastianbergmann/phpunit/issues/4144): Empty objects are converted to empty arrays in JSON comparison failure diff
|
||||
|
||||
## [8.5.2] - 2020-01-08
|
||||
|
||||
### Removed
|
||||
|
||||
* `eval-stdin.php` has been removed, it was not used anymore since PHPUnit 7.2.7
|
||||
|
||||
## [8.5.1] - 2019-12-25
|
||||
|
||||
### Changed
|
||||
|
||||
* `eval-stdin.php` can now only be executed with `cli` and `phpdbg`
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#3983](https://github.com/sebastianbergmann/phpunit/issues/3983): Deprecation warning given too eagerly
|
||||
|
||||
## [8.5.0] - 2019-12-06
|
||||
|
||||
### Added
|
||||
|
||||
* [#3911](https://github.com/sebastianbergmann/phpunit/issues/3911): Support combined use of `addMethods()` and `onlyMethods()`
|
||||
* [#3949](https://github.com/sebastianbergmann/phpunit/issues/3949): Introduce specialized assertions `assertFileEqualsCanonicalizing()`, `assertFileEqualsIgnoringCase()`, `assertStringEqualsFileCanonicalizing()`, `assertStringEqualsFileIgnoringCase()`, `assertFileNotEqualsCanonicalizing()`, `assertFileNotEqualsIgnoringCase()`, `assertStringNotEqualsFileCanonicalizing()`, and `assertStringNotEqualsFileIgnoringCase()` as alternative to using `assertFileEquals()` etc. with optional parameters
|
||||
|
||||
### Changed
|
||||
|
||||
* [#3860](https://github.com/sebastianbergmann/phpunit/pull/3860): Deprecate invoking PHPUnit commandline test runner with just a class name
|
||||
* [#3950](https://github.com/sebastianbergmann/phpunit/issues/3950): Deprecate optional parameters of `assertFileEquals()` etc.
|
||||
* [#3955](https://github.com/sebastianbergmann/phpunit/issues/3955): Deprecate support for doubling multiple interfaces
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#3953](https://github.com/sebastianbergmann/phpunit/issues/3953): Code Coverage for test executed in isolation does not work when the PHAR is used
|
||||
* [#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.31]: https://github.com/sebastianbergmann/phpunit/compare/8.5.30...8.5.31
|
||||
[8.5.30]: https://github.com/sebastianbergmann/phpunit/compare/8.5.29...8.5.30
|
||||
[8.5.29]: https://github.com/sebastianbergmann/phpunit/compare/8.5.28...8.5.29
|
||||
[8.5.28]: https://github.com/sebastianbergmann/phpunit/compare/8.5.27...8.5.28
|
||||
[8.5.27]: https://github.com/sebastianbergmann/phpunit/compare/8.5.26...8.5.27
|
||||
[8.5.26]: https://github.com/sebastianbergmann/phpunit/compare/8.5.25...8.5.26
|
||||
[8.5.25]: https://github.com/sebastianbergmann/phpunit/compare/8.5.24...8.5.25
|
||||
[8.5.24]: https://github.com/sebastianbergmann/phpunit/compare/8.5.23...8.5.24
|
||||
[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
|
||||
[8.5.19]: https://github.com/sebastianbergmann/phpunit/compare/8.5.18...8.5.19
|
||||
[8.5.18]: https://github.com/sebastianbergmann/phpunit/compare/8.5.17...8.5.18
|
||||
[8.5.17]: https://github.com/sebastianbergmann/phpunit/compare/8.5.16...8.5.17
|
||||
[8.5.16]: https://github.com/sebastianbergmann/phpunit/compare/8.5.15...8.5.16
|
||||
[8.5.15]: https://github.com/sebastianbergmann/phpunit/compare/8.5.14...8.5.15
|
||||
[8.5.14]: https://github.com/sebastianbergmann/phpunit/compare/8.5.13...8.5.14
|
||||
[8.5.13]: https://github.com/sebastianbergmann/phpunit/compare/8.5.12...8.5.13
|
||||
[8.5.12]: https://github.com/sebastianbergmann/phpunit/compare/8.5.11...8.5.12
|
||||
[8.5.11]: https://github.com/sebastianbergmann/phpunit/compare/8.5.10...8.5.11
|
||||
[8.5.10]: https://github.com/sebastianbergmann/phpunit/compare/8.5.9...8.5.10
|
||||
[8.5.9]: https://github.com/sebastianbergmann/phpunit/compare/8.5.8...8.5.9
|
||||
[8.5.8]: https://github.com/sebastianbergmann/phpunit/compare/8.5.7...8.5.8
|
||||
[8.5.7]: https://github.com/sebastianbergmann/phpunit/compare/8.5.6...8.5.7
|
||||
[8.5.6]: https://github.com/sebastianbergmann/phpunit/compare/8.5.5...8.5.6
|
||||
[8.5.5]: https://github.com/sebastianbergmann/phpunit/compare/8.5.4...8.5.5
|
||||
[8.5.4]: https://github.com/sebastianbergmann/phpunit/compare/8.5.3...8.5.4
|
||||
[8.5.3]: https://github.com/sebastianbergmann/phpunit/compare/8.5.2...8.5.3
|
||||
[8.5.2]: https://github.com/sebastianbergmann/phpunit/compare/8.5.1...8.5.2
|
||||
[8.5.1]: https://github.com/sebastianbergmann/phpunit/compare/8.5.0...8.5.1
|
||||
[8.5.0]: https://github.com/sebastianbergmann/phpunit/compare/8.4.3...8.5.0
|
||||
-235
@@ -1,235 +0,0 @@
|
||||
# Changes in PHPUnit 9.5
|
||||
|
||||
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.26] - 2022-10-28
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5076](https://github.com/sebastianbergmann/phpunit/issues/5076): Test Runner does not warn about conflicting options
|
||||
|
||||
## [9.5.25] - 2022-09-25
|
||||
|
||||
### Added
|
||||
|
||||
* [#5042](https://github.com/sebastianbergmann/phpunit/issues/5042): Support Disjunctive Normal Form types
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4966](https://github.com/sebastianbergmann/phpunit/issues/4966): `TestCase::assertSame()` (and related exact comparisons) must compare `float` exactly
|
||||
|
||||
## [9.5.24] - 2022-08-30
|
||||
|
||||
### Added
|
||||
|
||||
* [#4931](https://github.com/sebastianbergmann/phpunit/issues/4931): Support `null` and `false` as stand-alone types
|
||||
* [#4955](https://github.com/sebastianbergmann/phpunit/issues/4955): Support `true` as stand-alone type
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4913](https://github.com/sebastianbergmann/phpunit/issues/4913): Failed `assert()` should show a backtrace
|
||||
* [#5012](https://github.com/sebastianbergmann/phpunit/pull/5012): Memory leak in `ExceptionWrapper`
|
||||
|
||||
## [9.5.23] - 2022-08-22
|
||||
|
||||
### Changed
|
||||
|
||||
* [#5033](https://github.com/sebastianbergmann/phpunit/issues/5033): Do not depend on phpspec/prophecy
|
||||
|
||||
## [9.5.22] - 2022-08-20
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5015](https://github.com/sebastianbergmann/phpunit/pull/5015): Ukraine banner unreadable on black background
|
||||
* [#5020](https://github.com/sebastianbergmann/phpunit/issues/5020): PHPUnit 9 breaks loading of PSR-0/PEAR style classes
|
||||
* [#5022](https://github.com/sebastianbergmann/phpunit/issues/5022): `ExcludeList::addDirectory()` does not work correctly
|
||||
|
||||
## [9.5.21] - 2022-06-19
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4950](https://github.com/sebastianbergmann/phpunit/issues/4950): False error on `atMost()` invocation rule without call
|
||||
* [#4962](https://github.com/sebastianbergmann/phpunit/issues/4962): Ukraine banner unreadable on white background
|
||||
|
||||
## [9.5.20] - 2022-04-01
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4938](https://github.com/sebastianbergmann/phpunit/issues/4938): Test Double code generator does not handle `void` return type declaration on `__clone()` methods
|
||||
* [#4947](https://github.com/sebastianbergmann/phpunit/issues/4947): Test annotated with `@coversNothing` may lead to files missing from code coverage report
|
||||
|
||||
## [9.5.19] - 2022-03-15
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4929](https://github.com/sebastianbergmann/phpunit/issues/4929): Test Double code generator does not handle new expressions inside parameter default values
|
||||
* [#4932](https://github.com/sebastianbergmann/phpunit/issues/4932): Backport support for intersection types from PHPUnit 10 to PHPUnit 9.5
|
||||
* [#4933](https://github.com/sebastianbergmann/phpunit/issues/4933): Backport support for `never` type from PHPUnit 10 to PHPUnit 9.5
|
||||
|
||||
## [9.5.18] - 2022-03-08
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4877](https://github.com/sebastianbergmann/phpunit/issues/4877): No stack trace shown when an error occurs during bootstrap
|
||||
|
||||
## [9.5.17] - 2022-03-05 - #StandWithUkraine
|
||||
|
||||
## [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
|
||||
|
||||
* [#4812](https://github.com/sebastianbergmann/phpunit/issues/4812): Do not enforce time limits when a debugging session through DBGp is active
|
||||
* [#4835](https://github.com/sebastianbergmann/phpunit/issues/4835): Support for `$GLOBALS['_composer_autoload_path']` introduced in Composer 2.2
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4840](https://github.com/sebastianbergmann/phpunit/pull/4840): TestDox prettifying for class names does not correctly handle diacritics
|
||||
* [#4846](https://github.com/sebastianbergmann/phpunit/pull/4846): Composer proxy script is not ignored
|
||||
|
||||
## [9.5.10] - 2021-09-25
|
||||
|
||||
### Changed
|
||||
|
||||
* PHPUnit no longer converts PHP deprecations to exceptions by default (configure `convertDeprecationsToExceptions="true"` to enable this)
|
||||
* The PHPUnit XML configuration file generator now configures `convertDeprecationsToExceptions="true"`
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4772](https://github.com/sebastianbergmann/phpunit/pull/4772): TestDox HTML report not displayed correctly when browser has custom colour settings
|
||||
|
||||
## [9.5.9] - 2021-08-31
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4750](https://github.com/sebastianbergmann/phpunit/issues/4750): Automatic return value generation leads to invalid (and superfluous) test double code generation when a stubbed method returns `*|false`
|
||||
* [#4751](https://github.com/sebastianbergmann/phpunit/issues/4751): Configuration validation fails when using brackets in glob pattern
|
||||
|
||||
## [9.5.8] - 2021-07-31
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4740](https://github.com/sebastianbergmann/phpunit/issues/4740): `phpunit.phar` does not work with PHP 8.1
|
||||
|
||||
## [9.5.7] - 2021-07-19
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4720](https://github.com/sebastianbergmann/phpunit/issues/4720): PHPUnit does not verify its own PHP extension requirements
|
||||
* [#4735](https://github.com/sebastianbergmann/phpunit/issues/4735): Automated return value generation does not work for stubbed methods that return `*|false`
|
||||
|
||||
## [9.5.6] - 2021-06-23
|
||||
|
||||
### Changed
|
||||
|
||||
* PHPUnit now errors out on startup when `PHP_VERSION` contains a value that is not compatible with `version_compare()`, for instance `X.Y.Z-(to be removed in future macOS)`
|
||||
|
||||
## [9.5.5] - 2021-06-05
|
||||
|
||||
### Changed
|
||||
|
||||
* The test result cache (the storage for which is implemented in `PHPUnit\Runner\DefaultTestResultCache`) no longer uses PHP's `serialize()` and `unserialize()` functions for persistence. It now uses a versioned JSON format instead that is independent of PHP implementation details (see [#3581](https://github.com/sebastianbergmann/phpunit/issues/3581) and [#4662](https://github.com/sebastianbergmann/phpunit/pull/4662) for examples why this is a problem). When PHPUnit tries to load the test result cache from a file that does not exist, or from a file that does not contain data in JSON format, or from a file that contains data in a JSON format version other than the one used by the currently running PHPUnit version, then this is considered to be a "cache miss". An empty `DefaultTestResultCache` object is created in this case. This should also prevent PHPUnit from crashing when trying to load a test result cache file created by a different version of PHPUnit (see [#4580](https://github.com/sebastianbergmann/phpunit/issues/4580) for example).
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4632](https://github.com/sebastianbergmann/phpunit/issues/4632): TestDox result printer does not handle repeated test execution correctly
|
||||
* [#4678](https://github.com/sebastianbergmann/phpunit/pull/4678): Stubbed methods with `iterable` return types should return empty array by default
|
||||
* [#4692](https://github.com/sebastianbergmann/phpunit/issues/4692): Annotations in single-line doc-comments are not handled correctly
|
||||
* [#4694](https://github.com/sebastianbergmann/phpunit/issues/4694): `TestCase::getMockFromWsdl()` does not work with PHP 8.1-dev
|
||||
|
||||
## [9.5.4] - 2021-03-23
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4630](https://github.com/sebastianbergmann/phpunit/issues/4630): Empty test case class causes error in TestDox XML logger
|
||||
|
||||
## [9.5.3] - 2021-03-17
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4591](https://github.com/sebastianbergmann/phpunit/issues/4591): TeamCity logger logs warnings as test failures
|
||||
* [#4620](https://github.com/sebastianbergmann/phpunit/issues/4620): No useful output when an error occurs in the bootstrap script
|
||||
|
||||
## [9.5.2] - 2021-02-02
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4573](https://github.com/sebastianbergmann/phpunit/issues/4573): No stack trace printed when PHPUnit is used from PHAR
|
||||
* [#4590](https://github.com/sebastianbergmann/phpunit/issues/4590): `--coverage-text` CLI option is documented wrong
|
||||
|
||||
## [9.5.1] - 2021-01-17
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4572](https://github.com/sebastianbergmann/phpunit/issues/4572): Schema validation does not work with `%xx` sequences in path to `phpunit.xsd`
|
||||
|
||||
## [9.5.0] - 2020-12-04
|
||||
|
||||
### Changed
|
||||
|
||||
* [#4490](https://github.com/sebastianbergmann/phpunit/issues/4490): Emit Error instead of Warning when test case class cannot be instantiated
|
||||
* [#4491](https://github.com/sebastianbergmann/phpunit/issues/4491): Emit Error instead of Warning when data provider does not work correctly
|
||||
* [#4492](https://github.com/sebastianbergmann/phpunit/issues/4492): Emit Error instead of Warning when test double configuration is invalid
|
||||
* [#4493](https://github.com/sebastianbergmann/phpunit/issues/4493): Emit error when (configured) test directory does not exist
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly
|
||||
|
||||
[9.5.26]: https://github.com/sebastianbergmann/phpunit/compare/9.5.25...9.5.26
|
||||
[9.5.25]: https://github.com/sebastianbergmann/phpunit/compare/9.5.24...9.5.25
|
||||
[9.5.24]: https://github.com/sebastianbergmann/phpunit/compare/9.5.23...9.5.24
|
||||
[9.5.23]: https://github.com/sebastianbergmann/phpunit/compare/9.5.22...9.5.23
|
||||
[9.5.22]: https://github.com/sebastianbergmann/phpunit/compare/9.5.21...9.5.22
|
||||
[9.5.21]: https://github.com/sebastianbergmann/phpunit/compare/9.5.20...9.5.21
|
||||
[9.5.20]: https://github.com/sebastianbergmann/phpunit/compare/9.5.19...9.5.20
|
||||
[9.5.19]: https://github.com/sebastianbergmann/phpunit/compare/9.5.18...9.5.19
|
||||
[9.5.18]: https://github.com/sebastianbergmann/phpunit/compare/9.5.17...9.5.18
|
||||
[9.5.17]: https://github.com/sebastianbergmann/phpunit/compare/9.5.16...9.5.17
|
||||
[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
|
||||
[9.5.8]: https://github.com/sebastianbergmann/phpunit/compare/9.5.7...9.5.8
|
||||
[9.5.7]: https://github.com/sebastianbergmann/phpunit/compare/9.5.6...9.5.7
|
||||
[9.5.6]: https://github.com/sebastianbergmann/phpunit/compare/9.5.5...9.5.6
|
||||
[9.5.5]: https://github.com/sebastianbergmann/phpunit/compare/9.5.4...9.5.5
|
||||
[9.5.4]: https://github.com/sebastianbergmann/phpunit/compare/9.5.3...9.5.4
|
||||
[9.5.3]: https://github.com/sebastianbergmann/phpunit/compare/9.5.2...9.5.3
|
||||
[9.5.2]: https://github.com/sebastianbergmann/phpunit/compare/9.5.1...9.5.2
|
||||
[9.5.1]: https://github.com/sebastianbergmann/phpunit/compare/9.5.0...9.5.1
|
||||
[9.5.0]: https://github.com/sebastianbergmann/phpunit/compare/9.4.4...9.5.0
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
# Changes in PHPUnit 9.6
|
||||
|
||||
All notable changes of the PHPUnit 9.6 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [9.6.9] - 2023-06-11
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5405](https://github.com/sebastianbergmann/phpunit/issues/5405): XML configuration migration does not migrate `whitelist/file` elements
|
||||
* Always use `X.Y.Z` version number (and not just `X.Y`) of PHPUnit's version when checking whether a PHAR-distributed extension is compatible
|
||||
|
||||
## [9.6.8] - 2023-05-11
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5345](https://github.com/sebastianbergmann/phpunit/issues/5345): No stack trace shown for previous exceptions during bootstrap
|
||||
|
||||
## [9.6.7] - 2023-04-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* Tests that have `@doesNotPerformAssertions` do not contribute to code coverage
|
||||
|
||||
## [9.6.6] - 2023-03-27
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5270](https://github.com/sebastianbergmann/phpunit/issues/5270): `GlobalState::getIniSettingsAsString()` generates code that triggers warnings
|
||||
|
||||
## [9.6.5] - 2023-03-09
|
||||
|
||||
### Changed
|
||||
|
||||
* Backported the HTML and CSS improvements made to the `--testdox-html` from PHPUnit 10
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5205](https://github.com/sebastianbergmann/phpunit/issues/5205): Wrong default value for optional parameter of `PHPUnit\Util\Test::parseTestMethodAnnotations()` causes `ReflectionException`
|
||||
|
||||
## [9.6.4] - 2023-02-27
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5186](https://github.com/sebastianbergmann/phpunit/issues/5186): SBOM does not validate
|
||||
|
||||
## [9.6.3] - 2023-02-04
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5164](https://github.com/sebastianbergmann/phpunit/issues/5164): `markTestSkipped()` not handled correctly when called in "before first test" method
|
||||
|
||||
## [9.6.2] - 2023-02-04
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#4618](https://github.com/sebastianbergmann/phpunit/issues/4618): Support for generators in `assertCount()` etc. is not marked as deprecated in PHPUnit 9.6
|
||||
|
||||
## [9.6.1] - 2023-02-03
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#5073](https://github.com/sebastianbergmann/phpunit/issues/5073): `--no-extensions` CLI option only prevents extension PHARs from being loaded
|
||||
* [#5160](https://github.com/sebastianbergmann/phpunit/issues/5160): Deprecate `assertClassHasAttribute()`, `assertClassNotHasAttribute()`, `assertClassHasStaticAttribute()`, `assertClassNotHasStaticAttribute()`, `assertObjectHasAttribute()`, `assertObjectNotHasAttribute()`, `classHasAttribute()`, `classHasStaticAttribute()`, and `objectHasAttribute()`
|
||||
|
||||
## [9.6.0] - 2023-02-03
|
||||
|
||||
### Changed
|
||||
|
||||
* [#5062](https://github.com/sebastianbergmann/phpunit/issues/5062): Deprecate `expectDeprecation()`, `expectDeprecationMessage()`, `expectDeprecationMessageMatches()`, `expectError()`, `expectErrorMessage()`, `expectErrorMessageMatches()`, `expectNotice()`, `expectNoticeMessage()`, `expectNoticeMessageMatches()`, `expectWarning()`, `expectWarningMessage()`, and `expectWarningMessageMatches()`
|
||||
* [#5063](https://github.com/sebastianbergmann/phpunit/issues/5063): Deprecate `withConsecutive()`
|
||||
* [#5064](https://github.com/sebastianbergmann/phpunit/issues/5064): Deprecate `PHPUnit\Framework\TestCase::getMockClass()`
|
||||
* [#5132](https://github.com/sebastianbergmann/phpunit/issues/5132): Deprecate `Test` suffix for abstract test case classes
|
||||
|
||||
[9.6.9]: https://github.com/sebastianbergmann/phpunit/compare/9.6.8...9.6.9
|
||||
[9.6.8]: https://github.com/sebastianbergmann/phpunit/compare/9.6.7...9.6.8
|
||||
[9.6.7]: https://github.com/sebastianbergmann/phpunit/compare/9.6.6...9.6.7
|
||||
[9.6.6]: https://github.com/sebastianbergmann/phpunit/compare/9.6.5...9.6.6
|
||||
[9.6.5]: https://github.com/sebastianbergmann/phpunit/compare/9.6.4...9.6.5
|
||||
[9.6.4]: https://github.com/sebastianbergmann/phpunit/compare/9.6.3...9.6.4
|
||||
[9.6.3]: https://github.com/sebastianbergmann/phpunit/compare/9.6.2...9.6.3
|
||||
[9.6.2]: https://github.com/sebastianbergmann/phpunit/compare/9.6.1...9.6.2
|
||||
[9.6.1]: https://github.com/sebastianbergmann/phpunit/compare/9.6.0...9.6.1
|
||||
[9.6.0]: https://github.com/sebastianbergmann/phpunit/compare/9.5.28...9.6.0
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2001-2022, Sebastian Bergmann
|
||||
Copyright (c) 2001-2023, Sebastian Bergmann
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
+7
-14
@@ -2,12 +2,12 @@
|
||||
|
||||
# PHPUnit
|
||||
|
||||
PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.
|
||||
|
||||
[](https://packagist.org/packages/phpunit/phpunit)
|
||||
[](https://php.net/)
|
||||
[](https://phpunit.de/build-status.html)
|
||||
[](https://packagist.org/packages/phpunit/phpunit)
|
||||
[](https://github.com/sebastianbergmann/phpunit/actions)
|
||||
[](https://shepherd.dev/github/sebastianbergmann/phpunit)
|
||||
[](https://codecov.io/gh/sebastianbergmann/phpunit)
|
||||
|
||||
PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -25,7 +25,7 @@ Alternatively, you may use [Composer](https://getcomposer.org/) to download and
|
||||
|
||||
## Contribute
|
||||
|
||||
Please refer to [CONTRIBUTING.md](https://github.com/sebastianbergmann/phpunit/blob/master/.github/CONTRIBUTING.md) for information on how to contribute to PHPUnit and its related projects.
|
||||
Please refer to [CONTRIBUTING.md](https://github.com/sebastianbergmann/phpunit/blob/main/.github/CONTRIBUTING.md) for information on how to contribute to PHPUnit and its related projects.
|
||||
|
||||
## List of Contributors
|
||||
|
||||
@@ -34,12 +34,5 @@ Thanks to everyone who has contributed to PHPUnit! You can find a detailed list
|
||||
* [PHPUnit](https://github.com/sebastianbergmann/phpunit/graphs/contributors)
|
||||
* [php-code-coverage](https://github.com/sebastianbergmann/php-code-coverage/graphs/contributors)
|
||||
|
||||
A very special thanks to everyone who has contributed to the documentation and helps maintain the translations:
|
||||
|
||||
* [English](https://github.com/sebastianbergmann/phpunit-documentation-english/graphs/contributors)
|
||||
* [Spanish](https://github.com/sebastianbergmann/phpunit-documentation-spanish/graphs/contributors)
|
||||
* [French](https://github.com/sebastianbergmann/phpunit-documentation-french/graphs/contributors)
|
||||
* [Japanese](https://github.com/sebastianbergmann/phpunit-documentation-japanese/graphs/contributors)
|
||||
* [Brazilian Portuguese](https://github.com/sebastianbergmann/phpunit-documentation-brazilian-portuguese/graphs/contributors)
|
||||
* [Simplified Chinese](https://github.com/sebastianbergmann/phpunit-documentation-chinese/graphs/contributors)
|
||||
A very special thanks to everyone who has contributed to the [documentation](https://github.com/sebastianbergmann/phpunit-documentation-english/graphs/contributors).
|
||||
|
||||
|
||||
+25
-3
@@ -1,11 +1,33 @@
|
||||
# Security Policy
|
||||
|
||||
PHPUnit is a framework for writing as well as a commandline tool for running tests. Writing and running tests is a development-time activity. There is no reason why PHPUnit should be installed on a webserver.
|
||||
If you believe you have found a security vulnerability in PHPUnit, please report it to us through coordinated disclosure.
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
|
||||
|
||||
Instead, please email `sebastian@phpunit.de`.
|
||||
|
||||
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
|
||||
|
||||
* The type of issue
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
## Web Context
|
||||
|
||||
PHPUnit is a framework for writing as well as a command-line tool for running tests. Writing and running tests is a development-time activity. There is no reason why PHPUnit should be installed on a webserver and/or in a production environment.
|
||||
|
||||
**If you upload PHPUnit to a webserver then your deployment process is broken. On a more general note, if your `vendor` directory is publicly accessible on your webserver then your deployment process is also broken.**
|
||||
|
||||
Please note that if you upload PHPUnit to a webserver "bad things" may happen. [You have been warned.](https://thephp.cc/articles/phpunit-a-security-risk)
|
||||
|
||||
## Security Contact Information
|
||||
PHPUnit is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using PHPUnit in an HTTP or web context or with untrusted input data is performed. PHPUnit might also contain functionality that intentionally exposes internal application data for debugging purposes.
|
||||
|
||||
After the above, if you still would like to report a security vulnerability, please email `sebastian@phpunit.de`.
|
||||
If PHPUnit is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context.
|
||||
|
||||
Vulnerabilities specific to the use outside a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes.
|
||||
|
||||
+6
-5
@@ -17,7 +17,8 @@
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues"
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy"
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
@@ -28,7 +29,7 @@
|
||||
"ext-mbstring": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"doctrine/instantiator": "^1.3.1",
|
||||
"doctrine/instantiator": "^1.3.1 || ^2",
|
||||
"myclabs/deep-copy": "^1.10.1",
|
||||
"phar-io/manifest": "^2.0.3",
|
||||
"phar-io/version": "^3.0.2",
|
||||
@@ -57,8 +58,8 @@
|
||||
"sort-packages": true
|
||||
},
|
||||
"suggest": {
|
||||
"ext-soap": "*",
|
||||
"ext-xdebug": "*"
|
||||
"ext-soap": "To be able to generate mocks based on WSDL files",
|
||||
"ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
|
||||
},
|
||||
"bin": [
|
||||
"phpunit"
|
||||
@@ -83,7 +84,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "9.5-dev"
|
||||
"dev-master": "9.6-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-6
@@ -38,22 +38,31 @@ if (version_compare('7.3.0', PHP_VERSION, '>')) {
|
||||
die(1);
|
||||
}
|
||||
|
||||
foreach (['dom', 'json', 'libxml', 'mbstring', 'tokenizer', 'xml', 'xmlwriter'] as $extension) {
|
||||
if (extension_loaded($extension)) {
|
||||
continue;
|
||||
}
|
||||
$requiredExtensions = ['dom', 'json', 'libxml', 'mbstring', 'tokenizer', 'xml', 'xmlwriter'];
|
||||
|
||||
$unavailableExtensions = array_filter(
|
||||
$requiredExtensions,
|
||||
static function ($extension) {
|
||||
return !extension_loaded($extension);
|
||||
}
|
||||
);
|
||||
|
||||
if ([] !== $unavailableExtensions) {
|
||||
fwrite(
|
||||
STDERR,
|
||||
sprintf(
|
||||
'PHPUnit requires the "%s" extension.' . PHP_EOL,
|
||||
$extension
|
||||
'PHPUnit requires the "%s" extensions, but the "%s" %s not available.' . PHP_EOL,
|
||||
implode('", "', $requiredExtensions),
|
||||
implode('", "', $unavailableExtensions),
|
||||
count($unavailableExtensions) === 1 ? 'extension is' : 'extensions are'
|
||||
)
|
||||
);
|
||||
|
||||
die(1);
|
||||
}
|
||||
|
||||
unset($requiredExtensions, $unavailableExtensions);
|
||||
|
||||
if (!ini_get('date.timezone')) {
|
||||
ini_set('date.timezone', 'UTC');
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:annotation>
|
||||
<xs:documentation source="https://phpunit.de/documentation.html">
|
||||
This Schema file defines the rules by which the XML configuration file of PHPUnit 9.5 may be structured.
|
||||
This Schema file defines the rules by which the XML configuration file of PHPUnit 9.6 may be structured.
|
||||
</xs:documentation>
|
||||
<xs:appinfo source="https://phpunit.de/documentation.html"/>
|
||||
</xs:annotation>
|
||||
|
||||
+174
-102
@@ -37,6 +37,7 @@ use Countable;
|
||||
use DOMAttr;
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use Generator;
|
||||
use PHPUnit\Framework\Constraint\ArrayHasKey;
|
||||
use PHPUnit\Framework\Constraint\Callback;
|
||||
use PHPUnit\Framework\Constraint\ClassHasAttribute;
|
||||
@@ -110,14 +111,14 @@ abstract class Assert
|
||||
if (!(is_int($key) || is_string($key))) {
|
||||
throw InvalidArgumentException::create(
|
||||
1,
|
||||
'integer or string'
|
||||
'integer or string',
|
||||
);
|
||||
}
|
||||
|
||||
if (!(is_array($array) || $array instanceof ArrayAccess)) {
|
||||
throw InvalidArgumentException::create(
|
||||
2,
|
||||
'array or ArrayAccess'
|
||||
'array or ArrayAccess',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -141,19 +142,19 @@ abstract class Assert
|
||||
if (!(is_int($key) || is_string($key))) {
|
||||
throw InvalidArgumentException::create(
|
||||
1,
|
||||
'integer or string'
|
||||
'integer or string',
|
||||
);
|
||||
}
|
||||
|
||||
if (!(is_array($array) || $array instanceof ArrayAccess)) {
|
||||
throw InvalidArgumentException::create(
|
||||
2,
|
||||
'array or ArrayAccess'
|
||||
'array or ArrayAccess',
|
||||
);
|
||||
}
|
||||
|
||||
$constraint = new LogicalNot(
|
||||
new ArrayHasKey($key)
|
||||
new ArrayHasKey($key),
|
||||
);
|
||||
|
||||
static::assertThat($array, $constraint, $message);
|
||||
@@ -190,7 +191,7 @@ abstract class Assert
|
||||
public static function assertNotContains($needle, iterable $haystack, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(
|
||||
new TraversableContainsIdentical($needle)
|
||||
new TraversableContainsIdentical($needle),
|
||||
);
|
||||
|
||||
static::assertThat($haystack, $constraint, $message);
|
||||
@@ -219,9 +220,9 @@ abstract class Assert
|
||||
$haystack,
|
||||
new TraversableContainsOnly(
|
||||
$type,
|
||||
$isNativeType
|
||||
$isNativeType,
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -237,9 +238,9 @@ abstract class Assert
|
||||
$haystack,
|
||||
new TraversableContainsOnly(
|
||||
$className,
|
||||
false
|
||||
false,
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -260,10 +261,10 @@ abstract class Assert
|
||||
new LogicalNot(
|
||||
new TraversableContainsOnly(
|
||||
$type,
|
||||
$isNativeType
|
||||
)
|
||||
$isNativeType,
|
||||
),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -278,6 +279,10 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertCount(int $expectedCount, $haystack, string $message = ''): void
|
||||
{
|
||||
if ($haystack instanceof Generator) {
|
||||
self::createWarning('Passing an argument of type Generator for the $haystack parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
||||
}
|
||||
|
||||
if (!$haystack instanceof Countable && !is_iterable($haystack)) {
|
||||
throw InvalidArgumentException::create(2, 'countable or iterable');
|
||||
}
|
||||
@@ -285,7 +290,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$haystack,
|
||||
new Count($expectedCount),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -300,12 +305,16 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertNotCount(int $expectedCount, $haystack, string $message = ''): void
|
||||
{
|
||||
if ($haystack instanceof Generator) {
|
||||
self::createWarning('Passing an argument of type Generator for the $haystack parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
||||
}
|
||||
|
||||
if (!$haystack instanceof Countable && !is_iterable($haystack)) {
|
||||
throw InvalidArgumentException::create(2, 'countable or iterable');
|
||||
}
|
||||
|
||||
$constraint = new LogicalNot(
|
||||
new Count($expectedCount)
|
||||
new Count($expectedCount),
|
||||
);
|
||||
|
||||
static::assertThat($haystack, $constraint, $message);
|
||||
@@ -360,7 +369,7 @@ abstract class Assert
|
||||
{
|
||||
$constraint = new IsEqualWithDelta(
|
||||
$expected,
|
||||
$delta
|
||||
$delta,
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
@@ -375,7 +384,7 @@ abstract class Assert
|
||||
public static function assertNotEquals($expected, $actual, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqual($expected)
|
||||
new IsEqual($expected),
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
@@ -390,7 +399,7 @@ abstract class Assert
|
||||
public static function assertNotEqualsCanonicalizing($expected, $actual, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqualCanonicalizing($expected)
|
||||
new IsEqualCanonicalizing($expected),
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
@@ -405,7 +414,7 @@ abstract class Assert
|
||||
public static function assertNotEqualsIgnoringCase($expected, $actual, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqualIgnoringCase($expected)
|
||||
new IsEqualIgnoringCase($expected),
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
@@ -422,8 +431,8 @@ abstract class Assert
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqualWithDelta(
|
||||
$expected,
|
||||
$delta
|
||||
)
|
||||
$delta,
|
||||
),
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
@@ -437,7 +446,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
static::objectEquals($expected, $method),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -451,6 +460,10 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertEmpty($actual, string $message = ''): void
|
||||
{
|
||||
if ($actual instanceof Generator) {
|
||||
self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
||||
}
|
||||
|
||||
static::assertThat($actual, static::isEmpty(), $message);
|
||||
}
|
||||
|
||||
@@ -464,6 +477,10 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertNotEmpty($actual, string $message = ''): void
|
||||
{
|
||||
if ($actual instanceof Generator) {
|
||||
self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
||||
}
|
||||
|
||||
static::assertThat($actual, static::logicalNot(static::isEmpty()), $message);
|
||||
}
|
||||
|
||||
@@ -489,7 +506,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
static::greaterThanOrEqual($expected),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -545,7 +562,7 @@ abstract class Assert
|
||||
static::assertFileExists($actual, $message);
|
||||
|
||||
$constraint = new IsEqualCanonicalizing(
|
||||
file_get_contents($expected)
|
||||
file_get_contents($expected),
|
||||
);
|
||||
|
||||
static::assertThat(file_get_contents($actual), $constraint, $message);
|
||||
@@ -581,7 +598,7 @@ abstract class Assert
|
||||
static::assertFileExists($actual, $message);
|
||||
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqual(file_get_contents($expected))
|
||||
new IsEqual(file_get_contents($expected)),
|
||||
);
|
||||
|
||||
static::assertThat(file_get_contents($actual), $constraint, $message);
|
||||
@@ -600,7 +617,7 @@ abstract class Assert
|
||||
static::assertFileExists($actual, $message);
|
||||
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqualCanonicalizing(file_get_contents($expected))
|
||||
new IsEqualCanonicalizing(file_get_contents($expected)),
|
||||
);
|
||||
|
||||
static::assertThat(file_get_contents($actual), $constraint, $message);
|
||||
@@ -619,7 +636,7 @@ abstract class Assert
|
||||
static::assertFileExists($actual, $message);
|
||||
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqualIgnoringCase(file_get_contents($expected))
|
||||
new IsEqualIgnoringCase(file_get_contents($expected)),
|
||||
);
|
||||
|
||||
static::assertThat(file_get_contents($actual), $constraint, $message);
|
||||
@@ -685,7 +702,7 @@ abstract class Assert
|
||||
static::assertFileExists($expectedFile, $message);
|
||||
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqual(file_get_contents($expectedFile))
|
||||
new IsEqual(file_get_contents($expectedFile)),
|
||||
);
|
||||
|
||||
static::assertThat($actualString, $constraint, $message);
|
||||
@@ -703,7 +720,7 @@ abstract class Assert
|
||||
static::assertFileExists($expectedFile, $message);
|
||||
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqualCanonicalizing(file_get_contents($expectedFile))
|
||||
new IsEqualCanonicalizing(file_get_contents($expectedFile)),
|
||||
);
|
||||
|
||||
static::assertThat($actualString, $constraint, $message);
|
||||
@@ -721,7 +738,7 @@ abstract class Assert
|
||||
static::assertFileExists($expectedFile, $message);
|
||||
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqualIgnoringCase(file_get_contents($expectedFile))
|
||||
new IsEqualIgnoringCase(file_get_contents($expectedFile)),
|
||||
);
|
||||
|
||||
static::assertThat($actualString, $constraint, $message);
|
||||
@@ -1168,9 +1185,13 @@ abstract class Assert
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void
|
||||
{
|
||||
self::createWarning('assertClassHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
||||
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentException::create(1, 'valid attribute name');
|
||||
}
|
||||
@@ -1188,9 +1209,13 @@ abstract class Assert
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void
|
||||
{
|
||||
self::createWarning('assertClassNotHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
||||
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentException::create(1, 'valid attribute name');
|
||||
}
|
||||
@@ -1202,9 +1227,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$className,
|
||||
new LogicalNot(
|
||||
new ClassHasAttribute($attributeName)
|
||||
new ClassHasAttribute($attributeName),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1214,9 +1239,13 @@ abstract class Assert
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
|
||||
{
|
||||
self::createWarning('assertClassHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
|
||||
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentException::create(1, 'valid attribute name');
|
||||
}
|
||||
@@ -1228,7 +1257,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$className,
|
||||
new ClassHasStaticAttribute($attributeName),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1238,9 +1267,13 @@ abstract class Assert
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
|
||||
{
|
||||
self::createWarning('assertClassNotHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
|
||||
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentException::create(1, 'valid attribute name');
|
||||
}
|
||||
@@ -1252,9 +1285,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$className,
|
||||
new LogicalNot(
|
||||
new ClassHasStaticAttribute($attributeName)
|
||||
new ClassHasStaticAttribute($attributeName),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1266,9 +1299,13 @@ abstract class Assert
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void
|
||||
{
|
||||
self::createWarning('assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.');
|
||||
|
||||
if (!self::isValidObjectAttributeName($attributeName)) {
|
||||
throw InvalidArgumentException::create(1, 'valid attribute name');
|
||||
}
|
||||
@@ -1280,7 +1317,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$object,
|
||||
new ObjectHasAttribute($attributeName),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1292,9 +1329,13 @@ abstract class Assert
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void
|
||||
{
|
||||
self::createWarning('assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectNotHasProperty() (PHPUnit 10.1.0+) instead.');
|
||||
|
||||
if (!self::isValidObjectAttributeName($attributeName)) {
|
||||
throw InvalidArgumentException::create(1, 'valid attribute name');
|
||||
}
|
||||
@@ -1306,9 +1347,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$object,
|
||||
new LogicalNot(
|
||||
new ObjectHasAttribute($attributeName)
|
||||
new ObjectHasAttribute($attributeName),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1331,7 +1372,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsIdentical($expected),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1352,9 +1393,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(
|
||||
new IsIdentical($expected)
|
||||
new IsIdentical($expected),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1380,7 +1421,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsInstanceOf($expected),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1406,9 +1447,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(
|
||||
new IsInstanceOf($expected)
|
||||
new IsInstanceOf($expected),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1425,7 +1466,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_ARRAY),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1442,7 +1483,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_BOOL),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1459,7 +1500,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_FLOAT),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1476,7 +1517,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_INT),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1493,7 +1534,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_NUMERIC),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1510,7 +1551,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_OBJECT),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1527,7 +1568,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_RESOURCE),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1544,7 +1585,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_CLOSED_RESOURCE),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1561,7 +1602,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_STRING),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1578,7 +1619,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_SCALAR),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1595,7 +1636,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_CALLABLE),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1612,7 +1653,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_ITERABLE),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1629,7 +1670,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_ARRAY)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1646,7 +1687,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_BOOL)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1663,7 +1704,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_FLOAT)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1680,7 +1721,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_INT)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1697,7 +1738,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_NUMERIC)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1714,7 +1755,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_OBJECT)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1731,7 +1772,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_RESOURCE)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1748,7 +1789,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_CLOSED_RESOURCE)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1765,7 +1806,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_STRING)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1782,7 +1823,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_SCALAR)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1799,7 +1840,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_CALLABLE)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1816,7 +1857,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_ITERABLE)),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1859,9 +1900,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$string,
|
||||
new LogicalNot(
|
||||
new RegularExpression($pattern)
|
||||
new RegularExpression($pattern),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1882,9 +1923,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$string,
|
||||
new LogicalNot(
|
||||
new RegularExpression($pattern)
|
||||
new RegularExpression($pattern),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1901,6 +1942,14 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertSameSize($expected, $actual, string $message = ''): void
|
||||
{
|
||||
if ($expected instanceof Generator) {
|
||||
self::createWarning('Passing an argument of type Generator for the $expected parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
||||
}
|
||||
|
||||
if ($actual instanceof Generator) {
|
||||
self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
||||
}
|
||||
|
||||
if (!$expected instanceof Countable && !is_iterable($expected)) {
|
||||
throw InvalidArgumentException::create(1, 'countable or iterable');
|
||||
}
|
||||
@@ -1912,7 +1961,7 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new SameSize($expected),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1929,6 +1978,14 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertNotSameSize($expected, $actual, string $message = ''): void
|
||||
{
|
||||
if ($expected instanceof Generator) {
|
||||
self::createWarning('Passing an argument of type Generator for the $expected parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
||||
}
|
||||
|
||||
if ($actual instanceof Generator) {
|
||||
self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
||||
}
|
||||
|
||||
if (!$expected instanceof Countable && !is_iterable($expected)) {
|
||||
throw InvalidArgumentException::create(1, 'countable or iterable');
|
||||
}
|
||||
@@ -1940,9 +1997,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(
|
||||
new SameSize($expected)
|
||||
new SameSize($expected),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1968,9 +2025,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$string,
|
||||
new LogicalNot(
|
||||
new StringMatchesFormatDescription($format)
|
||||
new StringMatchesFormatDescription($format),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1987,9 +2044,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$string,
|
||||
new StringMatchesFormatDescription(
|
||||
file_get_contents($formatFile)
|
||||
file_get_contents($formatFile),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2007,10 +2064,10 @@ abstract class Assert
|
||||
$string,
|
||||
new LogicalNot(
|
||||
new StringMatchesFormatDescription(
|
||||
file_get_contents($formatFile)
|
||||
)
|
||||
file_get_contents($formatFile),
|
||||
),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2039,9 +2096,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$string,
|
||||
new LogicalNot(
|
||||
new StringStartsWith($prefix)
|
||||
new StringStartsWith($prefix),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2111,9 +2168,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$string,
|
||||
new LogicalNot(
|
||||
new StringEndsWith($suffix)
|
||||
new StringEndsWith($suffix),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2278,7 +2335,7 @@ abstract class Assert
|
||||
static::assertSame(
|
||||
$expectedElement->tagName,
|
||||
$actualElement->tagName,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
|
||||
if ($checkAttributes) {
|
||||
@@ -2289,8 +2346,8 @@ abstract class Assert
|
||||
'%s%sNumber of attributes on node "%s" does not match',
|
||||
$message,
|
||||
!empty($message) ? "\n" : '',
|
||||
$expectedElement->tagName
|
||||
)
|
||||
$expectedElement->tagName,
|
||||
),
|
||||
);
|
||||
|
||||
for ($i = 0; $i < $expectedElement->attributes->length; $i++) {
|
||||
@@ -2306,8 +2363,8 @@ abstract class Assert
|
||||
$message,
|
||||
!empty($message) ? "\n" : '',
|
||||
$expectedAttribute->name,
|
||||
$expectedElement->tagName
|
||||
)
|
||||
$expectedElement->tagName,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2323,8 +2380,8 @@ abstract class Assert
|
||||
'%s%sNumber of child nodes of "%s" differs',
|
||||
$message,
|
||||
!empty($message) ? "\n" : '',
|
||||
$expectedElement->tagName
|
||||
)
|
||||
$expectedElement->tagName,
|
||||
),
|
||||
);
|
||||
|
||||
for ($i = 0; $i < $expectedElement->childNodes->length; $i++) {
|
||||
@@ -2332,7 +2389,7 @@ abstract class Assert
|
||||
$expectedElement->childNodes->item($i),
|
||||
$actualElement->childNodes->item($i),
|
||||
$checkAttributes,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2392,9 +2449,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actualJson,
|
||||
new LogicalNot(
|
||||
new JsonMatches($expectedJson)
|
||||
new JsonMatches($expectedJson),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2432,9 +2489,9 @@ abstract class Assert
|
||||
static::assertThat(
|
||||
$actualJson,
|
||||
new LogicalNot(
|
||||
new JsonMatches($expectedJson)
|
||||
new JsonMatches($expectedJson),
|
||||
),
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2456,7 +2513,7 @@ abstract class Assert
|
||||
static::assertJson($actualJson, $message);
|
||||
|
||||
$constraintExpected = new JsonMatches(
|
||||
$expectedJson
|
||||
$expectedJson,
|
||||
);
|
||||
|
||||
$constraintActual = new JsonMatches($actualJson);
|
||||
@@ -2483,7 +2540,7 @@ abstract class Assert
|
||||
static::assertJson($actualJson, $message);
|
||||
|
||||
$constraintExpected = new JsonMatches(
|
||||
$expectedJson
|
||||
$expectedJson,
|
||||
);
|
||||
|
||||
$constraintActual = new JsonMatches($actualJson);
|
||||
@@ -2664,22 +2721,37 @@ abstract class Assert
|
||||
{
|
||||
return static::logicalOr(
|
||||
new IsEqual($value),
|
||||
new GreaterThan($value)
|
||||
new GreaterThan($value),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function classHasAttribute(string $attributeName): ClassHasAttribute
|
||||
{
|
||||
self::createWarning('classHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
||||
|
||||
return new ClassHasAttribute($attributeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute
|
||||
{
|
||||
self::createWarning('classHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
|
||||
|
||||
return new ClassHasStaticAttribute($attributeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
public static function objectHasAttribute($attributeName): ObjectHasAttribute
|
||||
{
|
||||
self::createWarning('objectHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
||||
|
||||
return new ObjectHasAttribute($attributeName);
|
||||
}
|
||||
|
||||
@@ -2707,7 +2779,7 @@ abstract class Assert
|
||||
{
|
||||
return static::logicalOr(
|
||||
new IsEqual($value),
|
||||
new LessThan($value)
|
||||
new LessThan($value),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2927,7 +2927,7 @@ if (!function_exists('PHPUnit\Framework\atLeast')) {
|
||||
function atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher
|
||||
{
|
||||
return new InvokedAtLeastCountMatcher(
|
||||
$requiredInvocations
|
||||
$requiredInvocations,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -40,7 +40,7 @@ class Count extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'count matches %d',
|
||||
$this->expectedCount
|
||||
$this->expectedCount,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class Count extends Constraint
|
||||
throw new Exception(
|
||||
$e->getMessage(),
|
||||
$e->getCode(),
|
||||
$e
|
||||
$e,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class Count extends Constraint
|
||||
return sprintf(
|
||||
'actual size %d matches expected size %d',
|
||||
(int) $this->getCountOf($other),
|
||||
$this->expectedCount
|
||||
$this->expectedCount,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ final class IsEmpty extends Constraint
|
||||
'%s %s %s',
|
||||
strpos($type, 'a') === 0 || strpos($type, 'o') === 0 ? 'an' : 'a',
|
||||
$type,
|
||||
$this->toString()
|
||||
$this->toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ abstract class Constraint implements Countable, SelfDescribing
|
||||
{
|
||||
$failureDescription = sprintf(
|
||||
'Failed asserting that %s.',
|
||||
$this->failureDescription($other)
|
||||
$this->failureDescription($other),
|
||||
);
|
||||
|
||||
$additionalFailureDescription = $this->additionalFailureDescription($other);
|
||||
@@ -121,7 +121,7 @@ abstract class Constraint implements Countable, SelfDescribing
|
||||
|
||||
throw new ExpectationFailedException(
|
||||
$failureDescription,
|
||||
$comparisonFailure
|
||||
$comparisonFailure,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -78,7 +78,7 @@ final class IsEqual extends Constraint
|
||||
try {
|
||||
$comparator = $comparatorFactory->getComparatorFor(
|
||||
$this->value,
|
||||
$other
|
||||
$other,
|
||||
);
|
||||
|
||||
$comparator->assertEquals(
|
||||
@@ -86,7 +86,7 @@ final class IsEqual extends Constraint
|
||||
$other,
|
||||
$this->delta,
|
||||
$this->canonicalize,
|
||||
$this->ignoreCase
|
||||
$this->ignoreCase,
|
||||
);
|
||||
} catch (ComparisonFailure $f) {
|
||||
if ($returnResult) {
|
||||
@@ -95,7 +95,7 @@ final class IsEqual extends Constraint
|
||||
|
||||
throw new ExpectationFailedException(
|
||||
trim($description . "\n" . $f->getMessage()),
|
||||
$f
|
||||
$f,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -118,21 +118,21 @@ final class IsEqual extends Constraint
|
||||
|
||||
return sprintf(
|
||||
"is equal to '%s'",
|
||||
$this->value
|
||||
$this->value,
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->delta != 0) {
|
||||
$delta = sprintf(
|
||||
' with delta <%F>',
|
||||
$this->delta
|
||||
$this->delta,
|
||||
);
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'is equal to %s%s',
|
||||
$this->exporter()->export($this->value),
|
||||
$delta
|
||||
$delta,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -58,7 +58,7 @@ final class IsEqualCanonicalizing extends Constraint
|
||||
try {
|
||||
$comparator = $comparatorFactory->getComparatorFor(
|
||||
$this->value,
|
||||
$other
|
||||
$other,
|
||||
);
|
||||
|
||||
$comparator->assertEquals(
|
||||
@@ -66,7 +66,7 @@ final class IsEqualCanonicalizing extends Constraint
|
||||
$other,
|
||||
0.0,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
} catch (ComparisonFailure $f) {
|
||||
if ($returnResult) {
|
||||
@@ -75,7 +75,7 @@ final class IsEqualCanonicalizing extends Constraint
|
||||
|
||||
throw new ExpectationFailedException(
|
||||
trim($description . "\n" . $f->getMessage()),
|
||||
$f
|
||||
$f,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,13 +96,13 @@ final class IsEqualCanonicalizing extends Constraint
|
||||
|
||||
return sprintf(
|
||||
"is equal to '%s'",
|
||||
$this->value
|
||||
$this->value,
|
||||
);
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'is equal to %s',
|
||||
$this->exporter()->export($this->value)
|
||||
$this->exporter()->export($this->value),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -58,7 +58,7 @@ final class IsEqualIgnoringCase extends Constraint
|
||||
try {
|
||||
$comparator = $comparatorFactory->getComparatorFor(
|
||||
$this->value,
|
||||
$other
|
||||
$other,
|
||||
);
|
||||
|
||||
$comparator->assertEquals(
|
||||
@@ -66,7 +66,7 @@ final class IsEqualIgnoringCase extends Constraint
|
||||
$other,
|
||||
0.0,
|
||||
false,
|
||||
true
|
||||
true,
|
||||
);
|
||||
} catch (ComparisonFailure $f) {
|
||||
if ($returnResult) {
|
||||
@@ -75,7 +75,7 @@ final class IsEqualIgnoringCase extends Constraint
|
||||
|
||||
throw new ExpectationFailedException(
|
||||
trim($description . "\n" . $f->getMessage()),
|
||||
$f
|
||||
$f,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,13 +96,13 @@ final class IsEqualIgnoringCase extends Constraint
|
||||
|
||||
return sprintf(
|
||||
"is equal to '%s'",
|
||||
$this->value
|
||||
$this->value,
|
||||
);
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'is equal to %s',
|
||||
$this->exporter()->export($this->value)
|
||||
$this->exporter()->export($this->value),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -62,13 +62,13 @@ final class IsEqualWithDelta extends Constraint
|
||||
try {
|
||||
$comparator = $comparatorFactory->getComparatorFor(
|
||||
$this->value,
|
||||
$other
|
||||
$other,
|
||||
);
|
||||
|
||||
$comparator->assertEquals(
|
||||
$this->value,
|
||||
$other,
|
||||
$this->delta
|
||||
$this->delta,
|
||||
);
|
||||
} catch (ComparisonFailure $f) {
|
||||
if ($returnResult) {
|
||||
@@ -77,7 +77,7 @@ final class IsEqualWithDelta extends Constraint
|
||||
|
||||
throw new ExpectationFailedException(
|
||||
trim($description . "\n" . $f->getMessage()),
|
||||
$f
|
||||
$f,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ final class IsEqualWithDelta extends Constraint
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf(
|
||||
'is equal to %s with delta <%F>>',
|
||||
'is equal to %s with delta <%F>',
|
||||
$this->exporter()->export($this->value),
|
||||
$this->delta
|
||||
$this->delta,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -36,7 +36,7 @@ final class Exception extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'exception of type "%s"',
|
||||
$this->className
|
||||
$this->className,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,13 +73,13 @@ final class Exception extends Constraint
|
||||
'exception of type "%s" matches expected exception "%s"%s',
|
||||
get_class($other),
|
||||
$this->className,
|
||||
$message
|
||||
$message,
|
||||
);
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'exception of type "%s" is thrown',
|
||||
$this->className
|
||||
$this->className,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ final class ExceptionCode extends Constraint
|
||||
return sprintf(
|
||||
'%s is equal to expected exception code %s',
|
||||
$this->exporter()->export($other->getCode()),
|
||||
$this->exporter()->export($this->expectedCode)
|
||||
$this->exporter()->export($this->expectedCode),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -65,14 +65,14 @@ final class ExceptionMessage extends Constraint
|
||||
if ($this->expectedMessage === '') {
|
||||
return sprintf(
|
||||
"exception message is empty but is '%s'",
|
||||
$other->getMessage()
|
||||
$other->getMessage(),
|
||||
);
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
"exception message '%s' contains '%s'",
|
||||
$other->getMessage(),
|
||||
$this->expectedMessage
|
||||
$this->expectedMessage,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ final class ExceptionMessageRegularExpression extends Constraint
|
||||
|
||||
if ($match === false) {
|
||||
throw new \PHPUnit\Framework\Exception(
|
||||
"Invalid expected exception message regex given: '{$this->expectedMessageRegExp}'"
|
||||
"Invalid expected exception message regex given: '{$this->expectedMessageRegExp}'",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ final class ExceptionMessageRegularExpression extends Constraint
|
||||
return sprintf(
|
||||
"exception message '%s' matches '%s'",
|
||||
$other->getMessage(),
|
||||
$this->expectedMessageRegExp
|
||||
$this->expectedMessageRegExp,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ final class DirectoryExists extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'directory "%s" exists',
|
||||
$other
|
||||
$other,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ final class FileExists extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'file "%s" exists',
|
||||
$other
|
||||
$other,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ final class IsReadable extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'"%s" is readable',
|
||||
$other
|
||||
$other,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ final class IsWritable extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'"%s" is writable',
|
||||
$other
|
||||
$other,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ final class IsIdentical extends Constraint
|
||||
$this->value,
|
||||
$other,
|
||||
sprintf("'%s'", $this->value),
|
||||
sprintf("'%s'", $other)
|
||||
sprintf("'%s'", $other),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ final class IsIdentical extends Constraint
|
||||
$this->value,
|
||||
$other,
|
||||
$this->exporter()->export($this->value),
|
||||
$this->exporter()->export($other)
|
||||
$this->exporter()->export($other),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ final class JsonMatches extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'matches JSON string "%s"',
|
||||
$this->value
|
||||
$this->value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ final class JsonMatches extends Constraint
|
||||
Json::prettify($recodedValue),
|
||||
Json::prettify($recodedOther),
|
||||
false,
|
||||
'Failed asserting that two json values are equal.'
|
||||
'Failed asserting that two json values are equal.',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+6
@@ -30,14 +30,19 @@ final class JsonMatchesErrorMessageProvider
|
||||
switch ($error) {
|
||||
case JSON_ERROR_NONE:
|
||||
return null;
|
||||
|
||||
case JSON_ERROR_DEPTH:
|
||||
return $prefix . 'Maximum stack depth exceeded';
|
||||
|
||||
case JSON_ERROR_STATE_MISMATCH:
|
||||
return $prefix . 'Underflow or the modes mismatch';
|
||||
|
||||
case JSON_ERROR_CTRL_CHAR:
|
||||
return $prefix . 'Unexpected control character found';
|
||||
|
||||
case JSON_ERROR_SYNTAX:
|
||||
return $prefix . 'Syntax error, malformed JSON';
|
||||
|
||||
case JSON_ERROR_UTF8:
|
||||
return $prefix . 'Malformed UTF-8 characters, possibly incorrectly encoded';
|
||||
|
||||
@@ -56,6 +61,7 @@ final class JsonMatchesErrorMessageProvider
|
||||
$prefix = 'Expected value JSON decode error - ';
|
||||
|
||||
break;
|
||||
|
||||
case 'actual':
|
||||
$prefix = 'Actual value JSON decode error - ';
|
||||
|
||||
|
||||
+6
-4
@@ -18,6 +18,8 @@ use ReflectionException;
|
||||
|
||||
/**
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
class ClassHasAttribute extends Constraint
|
||||
{
|
||||
@@ -38,7 +40,7 @@ class ClassHasAttribute extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'has attribute "%s"',
|
||||
$this->attributeName
|
||||
$this->attributeName,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,8 +58,8 @@ class ClassHasAttribute extends Constraint
|
||||
} catch (ReflectionException $e) {
|
||||
throw new Exception(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -77,7 +79,7 @@ class ClassHasAttribute extends Constraint
|
||||
'%sclass "%s" %s',
|
||||
is_object($other) ? 'object of ' : '',
|
||||
is_object($other) ? get_class($other) : $other,
|
||||
$this->toString()
|
||||
$this->toString(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -16,6 +16,8 @@ use ReflectionException;
|
||||
|
||||
/**
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
final class ClassHasStaticAttribute extends ClassHasAttribute
|
||||
{
|
||||
@@ -26,7 +28,7 @@ final class ClassHasStaticAttribute extends ClassHasAttribute
|
||||
{
|
||||
return sprintf(
|
||||
'has static attribute "%s"',
|
||||
$this->attributeName()
|
||||
$this->attributeName(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,8 +50,8 @@ final class ClassHasStaticAttribute extends ClassHasAttribute
|
||||
} catch (ReflectionException $e) {
|
||||
throw new Exception(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
+9
-9
@@ -65,7 +65,7 @@ final class ObjectEquals extends Constraint
|
||||
if (!$object->hasMethod($this->method)) {
|
||||
throw new ComparisonMethodDoesNotExistException(
|
||||
get_class($other),
|
||||
$this->method
|
||||
$this->method,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ final class ObjectEquals extends Constraint
|
||||
if (!$method->hasReturnType()) {
|
||||
throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(
|
||||
get_class($other),
|
||||
$this->method
|
||||
$this->method,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,28 +84,28 @@ final class ObjectEquals extends Constraint
|
||||
if (!$returnType instanceof ReflectionNamedType) {
|
||||
throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(
|
||||
get_class($other),
|
||||
$this->method
|
||||
$this->method,
|
||||
);
|
||||
}
|
||||
|
||||
if ($returnType->allowsNull()) {
|
||||
throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(
|
||||
get_class($other),
|
||||
$this->method
|
||||
$this->method,
|
||||
);
|
||||
}
|
||||
|
||||
if ($returnType->getName() !== 'bool') {
|
||||
throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(
|
||||
get_class($other),
|
||||
$this->method
|
||||
$this->method,
|
||||
);
|
||||
}
|
||||
|
||||
if ($method->getNumberOfParameters() !== 1 || $method->getNumberOfRequiredParameters() !== 1) {
|
||||
throw new ComparisonMethodDoesNotDeclareExactlyOneParameterException(
|
||||
get_class($other),
|
||||
$this->method
|
||||
$this->method,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ final class ObjectEquals extends Constraint
|
||||
if (!$parameter->hasType()) {
|
||||
throw new ComparisonMethodDoesNotDeclareParameterTypeException(
|
||||
get_class($other),
|
||||
$this->method
|
||||
$this->method,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ final class ObjectEquals extends Constraint
|
||||
if (!$type instanceof ReflectionNamedType) {
|
||||
throw new ComparisonMethodDoesNotDeclareParameterTypeException(
|
||||
get_class($other),
|
||||
$this->method
|
||||
$this->method,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ final class ObjectEquals extends Constraint
|
||||
throw new ComparisonMethodDoesNotAcceptParameterTypeException(
|
||||
get_class($other),
|
||||
$this->method,
|
||||
get_class($this->expected)
|
||||
get_class($this->expected),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -13,6 +13,8 @@ use ReflectionObject;
|
||||
|
||||
/**
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
||||
*/
|
||||
final class ObjectHasAttribute extends ClassHasAttribute
|
||||
{
|
||||
|
||||
+3
-3
@@ -63,15 +63,15 @@ final class LogicalNot extends UnaryOperator
|
||||
preg_replace(
|
||||
$positives,
|
||||
$negatives,
|
||||
$nonInput
|
||||
$nonInput,
|
||||
),
|
||||
$string
|
||||
$string,
|
||||
);
|
||||
} else {
|
||||
$negatedString = preg_replace(
|
||||
$positives,
|
||||
$negatives,
|
||||
$string
|
||||
$string,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ final class LogicalXor extends BinaryOperator
|
||||
{
|
||||
return $matches xor $constraint->evaluate($other, '', true);
|
||||
},
|
||||
$initial->evaluate($other, '', true)
|
||||
$initial->evaluate($other, '', true),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +65,13 @@ final class IsJson extends Constraint
|
||||
|
||||
json_decode($other);
|
||||
$error = (string) JsonMatchesErrorMessageProvider::determineJsonError(
|
||||
(string) json_last_error()
|
||||
(string) json_last_error(),
|
||||
);
|
||||
|
||||
return sprintf(
|
||||
'%s is valid JSON (%s)',
|
||||
$this->exporter()->shortenedExport($other),
|
||||
$error
|
||||
$error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ class RegularExpression extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'matches PCRE pattern "%s"',
|
||||
$this->pattern
|
||||
$this->pattern,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ final class StringContains extends Constraint
|
||||
|
||||
return sprintf(
|
||||
'contains "%s"',
|
||||
$string
|
||||
$string,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -33,8 +33,8 @@ final class StringMatchesFormatDescription extends RegularExpression
|
||||
{
|
||||
parent::__construct(
|
||||
$this->createPatternFromFormat(
|
||||
$this->convertNewlines($string)
|
||||
)
|
||||
$this->convertNewlines($string),
|
||||
),
|
||||
);
|
||||
|
||||
$this->string = $string;
|
||||
@@ -49,7 +49,7 @@ final class StringMatchesFormatDescription extends RegularExpression
|
||||
protected function matches($other): bool
|
||||
{
|
||||
return parent::matches(
|
||||
$this->convertNewlines($other)
|
||||
$this->convertNewlines($other),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ final class StringMatchesFormatDescription extends RegularExpression
|
||||
'%x' => '[0-9a-fA-F]+',
|
||||
'%f' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?',
|
||||
'%c' => '.',
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
return '/^' . $string . '$/s';
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
namespace PHPUnit\Framework\Constraint;
|
||||
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
use PHPUnit\Framework\InvalidArgumentException;
|
||||
|
||||
@@ -25,7 +24,7 @@ final class StringStartsWith extends Constraint
|
||||
|
||||
public function __construct(string $prefix)
|
||||
{
|
||||
if (strlen($prefix) === 0) {
|
||||
if ($prefix === '') {
|
||||
throw InvalidArgumentException::create(1, 'non-empty string');
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -52,7 +52,7 @@ abstract class TraversableContains extends Constraint
|
||||
return sprintf(
|
||||
'%s %s',
|
||||
is_array($other) ? 'an array' : 'a traversable',
|
||||
$this->toString()
|
||||
$this->toString(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -36,7 +36,7 @@ final class TraversableContainsOnly extends Constraint
|
||||
$this->constraint = new IsType($type);
|
||||
} else {
|
||||
$this->constraint = new IsInstanceOf(
|
||||
$type
|
||||
$type,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ final class IsInstanceOf extends Constraint
|
||||
return sprintf(
|
||||
'is instance of %s "%s"',
|
||||
$this->getType(),
|
||||
$this->className
|
||||
$this->className,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ final class IsInstanceOf extends Constraint
|
||||
'%s is an instance of %s "%s"',
|
||||
$this->exporter()->shortenedExport($other),
|
||||
$this->getType(),
|
||||
$this->className
|
||||
$this->className,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -130,8 +130,8 @@ final class IsType extends Constraint
|
||||
sprintf(
|
||||
'Type specified for PHPUnit\Framework\Constraint\IsType <%s> ' .
|
||||
'is not a valid type.',
|
||||
$type
|
||||
)
|
||||
$type,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ final class IsType extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'is of type "%s"',
|
||||
$this->type
|
||||
$this->type,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -21,7 +21,7 @@ final class ActualValueIsNotAnObjectException extends Exception
|
||||
parent::__construct(
|
||||
'Actual value is not an object',
|
||||
0,
|
||||
null
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -24,10 +24,10 @@ final class ComparisonMethodDoesNotAcceptParameterTypeException extends Exceptio
|
||||
'%s is not an accepted argument type for comparison method %s::%s().',
|
||||
$type,
|
||||
$className,
|
||||
$methodName
|
||||
$methodName,
|
||||
),
|
||||
0,
|
||||
null
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -23,10 +23,10 @@ final class ComparisonMethodDoesNotDeclareBoolReturnTypeException extends Except
|
||||
sprintf(
|
||||
'Comparison method %s::%s() does not declare bool return type.',
|
||||
$className,
|
||||
$methodName
|
||||
$methodName,
|
||||
),
|
||||
0,
|
||||
null
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -23,10 +23,10 @@ final class ComparisonMethodDoesNotDeclareExactlyOneParameterException extends E
|
||||
sprintf(
|
||||
'Comparison method %s::%s() does not declare exactly one parameter.',
|
||||
$className,
|
||||
$methodName
|
||||
$methodName,
|
||||
),
|
||||
0,
|
||||
null
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -23,10 +23,10 @@ final class ComparisonMethodDoesNotDeclareParameterTypeException extends Excepti
|
||||
sprintf(
|
||||
'Parameter of comparison method %s::%s() does not have a declared type.',
|
||||
$className,
|
||||
$methodName
|
||||
$methodName,
|
||||
),
|
||||
0,
|
||||
null
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -23,10 +23,10 @@ final class ComparisonMethodDoesNotExistException extends Exception
|
||||
sprintf(
|
||||
'Comparison method %s::%s() does not exist.',
|
||||
$className,
|
||||
$methodName
|
||||
$methodName,
|
||||
),
|
||||
0,
|
||||
null
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -34,8 +34,8 @@ final class InvalidArgumentException extends Exception
|
||||
$argument,
|
||||
$function,
|
||||
in_array(lcfirst($type)[0], ['a', 'e', 'i', 'o', 'u'], true) ? 'an' : 'a',
|
||||
$type
|
||||
)
|
||||
$type,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ final class ExecutionOrderDependency
|
||||
static function (self $d)
|
||||
{
|
||||
return $d->isValid();
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ final class ExecutionOrderDependency
|
||||
{
|
||||
return $dependency->getTarget();
|
||||
},
|
||||
$existing
|
||||
$existing,
|
||||
);
|
||||
|
||||
foreach ($additional as $dependency) {
|
||||
@@ -132,7 +132,7 @@ final class ExecutionOrderDependency
|
||||
{
|
||||
return $dependency->getTarget();
|
||||
},
|
||||
$right
|
||||
$right,
|
||||
);
|
||||
|
||||
foreach ($left as $dependency) {
|
||||
|
||||
@@ -42,7 +42,7 @@ trait Api
|
||||
{
|
||||
if (isset(static::$__phpunit_configurableMethods)) {
|
||||
throw new ConfigurableMethodsAlreadyInitializedException(
|
||||
'Configurable methods is already initialized and can not be reinitialized'
|
||||
'Configurable methods is already initialized and can not be reinitialized',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ trait Api
|
||||
if ($this->__phpunit_invocationMocker === null) {
|
||||
$this->__phpunit_invocationMocker = new InvocationHandler(
|
||||
static::$__phpunit_configurableMethods,
|
||||
$this->__phpunit_returnValueGeneration
|
||||
$this->__phpunit_returnValueGeneration,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ trait Method
|
||||
|
||||
return call_user_func_array(
|
||||
[$expects, 'method'],
|
||||
func_get_args()
|
||||
func_get_args(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -194,6 +194,8 @@ final class InvocationMocker implements InvocationStubber, MethodNameMatch
|
||||
* @throws MethodParametersAlreadyConfiguredException
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function withConsecutive(...$arguments): self
|
||||
{
|
||||
@@ -239,7 +241,7 @@ final class InvocationMocker implements InvocationStubber, MethodNameMatch
|
||||
{
|
||||
return strtolower($configurable->getName());
|
||||
},
|
||||
$this->configurableMethods
|
||||
$this->configurableMethods,
|
||||
);
|
||||
|
||||
if (is_string($constraint) && !in_array(strtolower($constraint), $configurableMethodNames, true)) {
|
||||
@@ -298,7 +300,7 @@ final class InvocationMocker implements InvocationStubber, MethodNameMatch
|
||||
if (!$configuredMethod->mayReturn($value)) {
|
||||
throw new IncompatibleReturnValueException(
|
||||
$configuredMethod,
|
||||
$value
|
||||
$value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -20,46 +20,46 @@ interface InvocationStubber
|
||||
public function will(Stub $stub): Identity;
|
||||
|
||||
/** @return self */
|
||||
public function willReturn($value, ...$nextValues)/*: self */;
|
||||
public function willReturn($value, ...$nextValues)/* : self */;
|
||||
|
||||
/**
|
||||
* @param mixed $reference
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function willReturnReference(&$reference)/*: self */;
|
||||
public function willReturnReference(&$reference)/* : self */;
|
||||
|
||||
/**
|
||||
* @param array<int, array<int, mixed>> $valueMap
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function willReturnMap(array $valueMap)/*: self */;
|
||||
public function willReturnMap(array $valueMap)/* : self */;
|
||||
|
||||
/**
|
||||
* @param int $argumentIndex
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function willReturnArgument($argumentIndex)/*: self */;
|
||||
public function willReturnArgument($argumentIndex)/* : self */;
|
||||
|
||||
/**
|
||||
* @param callable $callback
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function willReturnCallback($callback)/*: self */;
|
||||
public function willReturnCallback($callback)/* : self */;
|
||||
|
||||
/** @return self */
|
||||
public function willReturnSelf()/*: self */;
|
||||
public function willReturnSelf()/* : self */;
|
||||
|
||||
/**
|
||||
* @param mixed $values
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function willReturnOnConsecutiveCalls(...$values)/*: self */;
|
||||
public function willReturnOnConsecutiveCalls(...$values)/* : self */;
|
||||
|
||||
/** @return self */
|
||||
public function willThrowException(Throwable $exception)/*: self */;
|
||||
public function willThrowException(Throwable $exception)/* : self */;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -22,8 +22,8 @@ final class CannotUseAddMethodsException extends \PHPUnit\Framework\Exception im
|
||||
sprintf(
|
||||
'Trying to configure method "%s" with addMethods(), but it exists in class "%s". Use onlyMethods() for methods that exist in the class',
|
||||
$methodName,
|
||||
$type
|
||||
)
|
||||
$type,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -22,8 +22,8 @@ final class CannotUseOnlyMethodsException extends \PHPUnit\Framework\Exception i
|
||||
sprintf(
|
||||
'Trying to configure method "%s" with onlyMethods(), but it does not exist in class "%s". Use addMethods() for methods that do not exist in the class',
|
||||
$methodName,
|
||||
$type
|
||||
)
|
||||
$type,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -21,8 +21,8 @@ final class ClassAlreadyExistsException extends \PHPUnit\Framework\Exception imp
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Class "%s" already exists',
|
||||
$className
|
||||
)
|
||||
$className,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -21,8 +21,8 @@ final class ClassIsFinalException extends \PHPUnit\Framework\Exception implement
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Class "%s" is declared "final" and cannot be doubled',
|
||||
$className
|
||||
)
|
||||
$className,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace PHPUnit\Framework\MockObject;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
/**
|
||||
* @internal This class is not covered by the backward compatibility promise for PHPUnit
|
||||
*/
|
||||
final class ClassIsReadonlyException extends \PHPUnit\Framework\Exception implements Exception
|
||||
{
|
||||
public function __construct(string $className)
|
||||
{
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Class "%s" is declared "readonly" and cannot be doubled',
|
||||
$className,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Vendored
+2
-2
@@ -28,8 +28,8 @@ final class DuplicateMethodException extends \PHPUnit\Framework\Exception implem
|
||||
sprintf(
|
||||
'Cannot double using a method list that contains duplicates: "%s" (duplicate: "%s")',
|
||||
implode(', ', $methods),
|
||||
implode(', ', array_unique(array_diff_assoc($methods, array_unique($methods))))
|
||||
)
|
||||
implode(', ', array_unique(array_diff_assoc($methods, array_unique($methods)))),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@ final class IncompatibleReturnValueException extends \PHPUnit\Framework\Exceptio
|
||||
'Method %s may not return value of type %s, its declared return type is "%s"',
|
||||
$method->getName(),
|
||||
is_object($value) ? get_class($value) : gettype($value),
|
||||
$method->getReturnTypeDeclaration()
|
||||
)
|
||||
$method->getReturnTypeDeclaration(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -21,8 +21,8 @@ final class InvalidMethodNameException extends \PHPUnit\Framework\Exception impl
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Cannot double method with invalid name "%s"',
|
||||
$method
|
||||
)
|
||||
$method,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -21,8 +21,8 @@ final class MatchBuilderNotFoundException extends \PHPUnit\Framework\Exception i
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'No builder found for match builder identification <%s>',
|
||||
$id
|
||||
)
|
||||
$id,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@ final class MatcherAlreadyRegisteredException extends \PHPUnit\Framework\Excepti
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Matcher with id <%s> is already registered',
|
||||
$id
|
||||
)
|
||||
$id,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@ final class MethodCannotBeConfiguredException extends \PHPUnit\Framework\Excepti
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Trying to configure method "%s" which cannot be configured because it does not exist, has not been specified, is final, or is static',
|
||||
$method
|
||||
)
|
||||
$method,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ final class ReturnValueNotConfiguredException extends \PHPUnit\Framework\Excepti
|
||||
sprintf(
|
||||
'Return value inference disabled and no expectation set up for %s::%s()',
|
||||
$invocation->getClassName(),
|
||||
$invocation->getMethodName()
|
||||
)
|
||||
$invocation->getMethodName(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ final class SoapExtensionNotAvailableException extends \PHPUnit\Framework\Except
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
'The SOAP extension is required to generate a test double from WSDL'
|
||||
'The SOAP extension is required to generate a test double from WSDL',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -21,8 +21,8 @@ final class UnknownClassException extends \PHPUnit\Framework\Exception implement
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Class "%s" does not exist',
|
||||
$className
|
||||
)
|
||||
$className,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -21,8 +21,8 @@ final class UnknownTraitException extends \PHPUnit\Framework\Exception implement
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Trait "%s" does not exist',
|
||||
$traitName
|
||||
)
|
||||
$traitName,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@ final class UnknownTypeException extends \PHPUnit\Framework\Exception implements
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Class or interface "%s" does not exist',
|
||||
$type
|
||||
)
|
||||
$type,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ use function interface_exists;
|
||||
use function is_array;
|
||||
use function is_object;
|
||||
use function md5;
|
||||
use function method_exists;
|
||||
use function mt_rand;
|
||||
use function preg_match;
|
||||
use function preg_match_all;
|
||||
@@ -71,7 +72,6 @@ trait MockedCloneMethodWithVoidReturnType
|
||||
}
|
||||
}
|
||||
EOT;
|
||||
|
||||
private const MOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT = <<<'EOT'
|
||||
namespace PHPUnit\Framework\MockObject;
|
||||
|
||||
@@ -83,7 +83,6 @@ trait MockedCloneMethodWithoutReturnType
|
||||
}
|
||||
}
|
||||
EOT;
|
||||
|
||||
private const UNMOCKED_CLONE_METHOD_WITH_VOID_RETURN_TYPE_TRAIT = <<<'EOT'
|
||||
namespace PHPUnit\Framework\MockObject;
|
||||
|
||||
@@ -97,7 +96,6 @@ trait UnmockedCloneMethodWithVoidReturnType
|
||||
}
|
||||
}
|
||||
EOT;
|
||||
|
||||
private const UNMOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT = <<<'EOT'
|
||||
namespace PHPUnit\Framework\MockObject;
|
||||
|
||||
@@ -146,6 +144,7 @@ EOT;
|
||||
* @throws \PHPUnit\Framework\InvalidArgumentException
|
||||
* @throws ClassAlreadyExistsException
|
||||
* @throws ClassIsFinalException
|
||||
* @throws ClassIsReadonlyException
|
||||
* @throws DuplicateMethodException
|
||||
* @throws InvalidMethodNameException
|
||||
* @throws OriginalConstructorInvocationRequiredException
|
||||
@@ -186,8 +185,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -208,7 +207,7 @@ EOT;
|
||||
$callOriginalClone,
|
||||
$callAutoload,
|
||||
$cloneArguments,
|
||||
$callOriginalMethods
|
||||
$callOriginalMethods,
|
||||
);
|
||||
|
||||
return $this->getObject(
|
||||
@@ -219,7 +218,7 @@ EOT;
|
||||
$arguments,
|
||||
$callOriginalMethods,
|
||||
$proxyTarget,
|
||||
$returnValueGeneration
|
||||
$returnValueGeneration,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -266,7 +265,7 @@ EOT;
|
||||
$intersectionName = sprintf(
|
||||
'Intersection_%s_%s',
|
||||
implode('_', $unqualifiedNames),
|
||||
substr(md5((string) mt_rand()), 0, 8)
|
||||
substr(md5((string) mt_rand()), 0, 8),
|
||||
);
|
||||
} while (interface_exists($intersectionName, false));
|
||||
|
||||
@@ -276,7 +275,7 @@ EOT;
|
||||
[
|
||||
'intersection' => $intersectionName,
|
||||
'interfaces' => implode(', ', $interfaces),
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
eval($template->render());
|
||||
@@ -299,6 +298,7 @@ EOT;
|
||||
* @throws \PHPUnit\Framework\InvalidArgumentException
|
||||
* @throws ClassAlreadyExistsException
|
||||
* @throws ClassIsFinalException
|
||||
* @throws ClassIsReadonlyException
|
||||
* @throws DuplicateMethodException
|
||||
* @throws InvalidMethodNameException
|
||||
* @throws OriginalConstructorInvocationRequiredException
|
||||
@@ -317,8 +317,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -343,7 +343,7 @@ EOT;
|
||||
$callOriginalConstructor,
|
||||
$callOriginalClone,
|
||||
$callAutoload,
|
||||
$cloneArguments
|
||||
$cloneArguments,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -360,6 +360,7 @@ EOT;
|
||||
* @throws \PHPUnit\Framework\InvalidArgumentException
|
||||
* @throws ClassAlreadyExistsException
|
||||
* @throws ClassIsFinalException
|
||||
* @throws ClassIsReadonlyException
|
||||
* @throws DuplicateMethodException
|
||||
* @throws InvalidMethodNameException
|
||||
* @throws OriginalConstructorInvocationRequiredException
|
||||
@@ -378,7 +379,7 @@ EOT;
|
||||
$className = $this->generateClassName(
|
||||
$traitName,
|
||||
'',
|
||||
'Trait_'
|
||||
'Trait_',
|
||||
);
|
||||
|
||||
$classTemplate = $this->getTemplate('trait_class.tpl');
|
||||
@@ -388,7 +389,7 @@ EOT;
|
||||
'prologue' => 'abstract ',
|
||||
'class_name' => $className['className'],
|
||||
'trait_name' => $traitName,
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
$mockTrait = new MockTrait($classTemplate->render(), $className['className']);
|
||||
@@ -415,7 +416,7 @@ EOT;
|
||||
$className = $this->generateClassName(
|
||||
$traitName,
|
||||
$traitClassName,
|
||||
'Trait_'
|
||||
'Trait_',
|
||||
);
|
||||
|
||||
$classTemplate = $this->getTemplate('trait_class.tpl');
|
||||
@@ -425,23 +426,24 @@ EOT;
|
||||
'prologue' => '',
|
||||
'class_name' => $className['className'],
|
||||
'trait_name' => $traitName,
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
return $this->getObject(
|
||||
new MockTrait(
|
||||
$classTemplate->render(),
|
||||
$className['className']
|
||||
$className['className'],
|
||||
),
|
||||
'',
|
||||
$callOriginalConstructor,
|
||||
$callAutoload,
|
||||
$arguments
|
||||
$arguments,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ClassIsFinalException
|
||||
* @throws ClassIsReadonlyException
|
||||
* @throws ReflectionException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
@@ -455,7 +457,7 @@ EOT;
|
||||
$callOriginalClone,
|
||||
$callAutoload,
|
||||
$cloneArguments,
|
||||
$callOriginalMethods
|
||||
$callOriginalMethods,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -464,7 +466,7 @@ EOT;
|
||||
serialize($methods) .
|
||||
serialize($callOriginalClone) .
|
||||
serialize($cloneArguments) .
|
||||
serialize($callOriginalMethods)
|
||||
serialize($callOriginalMethods),
|
||||
);
|
||||
|
||||
if (!isset(self::$cache[$key])) {
|
||||
@@ -475,7 +477,7 @@ EOT;
|
||||
$callOriginalClone,
|
||||
$callAutoload,
|
||||
$cloneArguments,
|
||||
$callOriginalMethods
|
||||
$callOriginalMethods,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -501,8 +503,8 @@ EOT;
|
||||
} catch (SoapFault $e) {
|
||||
throw new RuntimeException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -521,7 +523,7 @@ EOT;
|
||||
if (empty($methods) || in_array($name, $methods, true)) {
|
||||
$args = explode(
|
||||
',',
|
||||
str_replace(')', '', substr($method, $nameEnd + 1))
|
||||
str_replace(')', '', substr($method, $nameEnd + 1)),
|
||||
);
|
||||
|
||||
foreach (range(0, count($args) - 1) as $i) {
|
||||
@@ -538,7 +540,7 @@ EOT;
|
||||
[
|
||||
'method_name' => $name,
|
||||
'arguments' => implode(', ', $args),
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
$methodsBuffer .= $methodTemplate->render();
|
||||
@@ -569,7 +571,7 @@ EOT;
|
||||
'wsdl' => $wsdlFile,
|
||||
'options' => $optionsBuffer,
|
||||
'methods' => $methodsBuffer,
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
return $classTemplate->render();
|
||||
@@ -588,8 +590,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -618,8 +620,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -648,8 +650,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -678,8 +680,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -715,8 +717,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -742,8 +744,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -764,6 +766,7 @@ EOT;
|
||||
|
||||
/**
|
||||
* @throws ClassIsFinalException
|
||||
* @throws ClassIsReadonlyException
|
||||
* @throws ReflectionException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
@@ -781,7 +784,7 @@ EOT;
|
||||
$_mockClassName = $this->generateClassName(
|
||||
$type,
|
||||
$mockClassName,
|
||||
'Mock_'
|
||||
'Mock_',
|
||||
);
|
||||
|
||||
if (class_exists($_mockClassName['fullClassName'], $callAutoload)) {
|
||||
@@ -809,8 +812,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -819,6 +822,10 @@ EOT;
|
||||
throw new ClassIsFinalException($_mockClassName['fullClassName']);
|
||||
}
|
||||
|
||||
if (method_exists($class, 'isReadOnly') && $class->isReadOnly()) {
|
||||
throw new ClassIsReadonlyException($_mockClassName['fullClassName']);
|
||||
}
|
||||
|
||||
// @see https://github.com/sebastianbergmann/phpunit/issues/2995
|
||||
if ($isInterface && $class->implementsInterface(Throwable::class)) {
|
||||
$actualClassName = Exception::class;
|
||||
@@ -831,8 +838,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -847,8 +854,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -859,14 +866,14 @@ EOT;
|
||||
}
|
||||
|
||||
$mockMethods->addMethods(
|
||||
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)
|
||||
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments),
|
||||
);
|
||||
}
|
||||
|
||||
$_mockClassName = $this->generateClassName(
|
||||
$actualClassName,
|
||||
$_mockClassName['className'],
|
||||
'Mock_'
|
||||
'Mock_',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -877,7 +884,7 @@ EOT;
|
||||
$additionalInterfaces[] = Iterator::class;
|
||||
|
||||
$mockMethods->addMethods(
|
||||
...$this->mockClassMethods(Iterator::class, $callOriginalMethods, $cloneArguments)
|
||||
...$this->mockClassMethods(Iterator::class, $callOriginalMethods, $cloneArguments),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -888,8 +895,8 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -908,13 +915,13 @@ EOT;
|
||||
|
||||
if ($isClass && $explicitMethods === []) {
|
||||
$mockMethods->addMethods(
|
||||
...$this->mockClassMethods($_mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments)
|
||||
...$this->mockClassMethods($_mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments),
|
||||
);
|
||||
}
|
||||
|
||||
if ($isInterface && ($explicitMethods === [] || $explicitMethods === null)) {
|
||||
$mockMethods->addMethods(
|
||||
...$this->mockInterfaceMethods($_mockClassName['fullClassName'], $cloneArguments)
|
||||
...$this->mockInterfaceMethods($_mockClassName['fullClassName'], $cloneArguments),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -927,15 +934,15 @@ EOT;
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
if ($this->canMockMethod($method)) {
|
||||
$mockMethods->addMethods(
|
||||
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)
|
||||
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -943,8 +950,8 @@ EOT;
|
||||
MockMethod::fromName(
|
||||
$_mockClassName['fullClassName'],
|
||||
$methodName,
|
||||
$cloneArguments
|
||||
)
|
||||
$cloneArguments,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -981,19 +988,19 @@ EOT;
|
||||
'class_declaration' => $this->generateMockClassDeclaration(
|
||||
$_mockClassName,
|
||||
$isInterface,
|
||||
$additionalInterfaces
|
||||
$additionalInterfaces,
|
||||
),
|
||||
'clone' => $cloneTrait,
|
||||
'mock_class_name' => $_mockClassName['className'],
|
||||
'mocked_methods' => $mockedMethods,
|
||||
'method' => $method,
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
return new MockClass(
|
||||
$classTemplate->render(),
|
||||
$_mockClassName['className'],
|
||||
$configurable
|
||||
$configurable,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1040,7 +1047,7 @@ EOT;
|
||||
$buffer .= sprintf(
|
||||
'%s implements %s',
|
||||
$mockClassName['className'],
|
||||
$interfaces
|
||||
$interfaces,
|
||||
);
|
||||
|
||||
if (!in_array($mockClassName['originalClassName'], $additionalInterfaces, true)) {
|
||||
@@ -1058,7 +1065,7 @@ EOT;
|
||||
$mockClassName['className'],
|
||||
!empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '',
|
||||
$mockClassName['originalClassName'],
|
||||
$interfaces
|
||||
$interfaces,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1088,8 +1095,8 @@ EOT;
|
||||
} catch (TemplateException $e) {
|
||||
throw new RuntimeException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ final class Invocation implements SelfDescribing
|
||||
throw new RuntimeException(
|
||||
$t->getMessage(),
|
||||
(int) $t->getCode(),
|
||||
$t
|
||||
$t,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ final class Invocation implements SelfDescribing
|
||||
throw new RuntimeException(
|
||||
$t->getMessage(),
|
||||
(int) $t->getCode(),
|
||||
$t
|
||||
$t,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -256,8 +256,8 @@ final class Invocation implements SelfDescribing
|
||||
'Return value for %s::%s() cannot be generated%s, please configure a return value for this method',
|
||||
$this->className,
|
||||
$this->methodName,
|
||||
$reason
|
||||
)
|
||||
$reason,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -273,10 +273,10 @@ final class Invocation implements SelfDescribing
|
||||
', ',
|
||||
array_map(
|
||||
[$exporter, 'shortenedExport'],
|
||||
$this->parameters
|
||||
)
|
||||
$this->parameters,
|
||||
),
|
||||
),
|
||||
$this->returnType ? sprintf(': %s', $this->returnType) : ''
|
||||
$this->returnType ? sprintf(': %s', $this->returnType) : '',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ final class InvocationHandler
|
||||
return new InvocationMocker(
|
||||
$this,
|
||||
$matcher,
|
||||
...$this->configurableMethods
|
||||
...$this->configurableMethods,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,8 +117,8 @@ final class Matcher
|
||||
|
||||
if ($this->afterMatchBuilderId !== null) {
|
||||
$matcher = $invocation->getObject()
|
||||
->__phpunit_getInvocationHandler()
|
||||
->lookupMatcher($this->afterMatchBuilderId);
|
||||
->__phpunit_getInvocationHandler()
|
||||
->lookupMatcher($this->afterMatchBuilderId);
|
||||
|
||||
if (!$matcher) {
|
||||
throw new MatchBuilderNotFoundException($this->afterMatchBuilderId);
|
||||
@@ -143,9 +143,9 @@ final class Matcher
|
||||
"Expectation failed for %s when %s\n%s",
|
||||
$this->methodNameRule->toString(),
|
||||
$this->invocationRule->toString(),
|
||||
$e->getMessage()
|
||||
$e->getMessage(),
|
||||
),
|
||||
$e->getComparisonFailure()
|
||||
$e->getComparisonFailure(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -167,8 +167,8 @@ final class Matcher
|
||||
{
|
||||
if ($this->afterMatchBuilderId !== null) {
|
||||
$matcher = $invocation->getObject()
|
||||
->__phpunit_getInvocationHandler()
|
||||
->lookupMatcher($this->afterMatchBuilderId);
|
||||
->__phpunit_getInvocationHandler()
|
||||
->lookupMatcher($this->afterMatchBuilderId);
|
||||
|
||||
if (!$matcher) {
|
||||
throw new MatchBuilderNotFoundException($this->afterMatchBuilderId);
|
||||
@@ -199,9 +199,9 @@ final class Matcher
|
||||
"Expectation failed for %s when %s\n%s",
|
||||
$this->methodNameRule->toString(),
|
||||
$this->invocationRule->toString(),
|
||||
$e->getMessage()
|
||||
$e->getMessage(),
|
||||
),
|
||||
$e->getComparisonFailure()
|
||||
$e->getComparisonFailure(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -239,8 +239,8 @@ final class Matcher
|
||||
"Expectation failed for %s when %s.\n%s",
|
||||
$this->methodNameRule->toString(),
|
||||
$this->invocationRule->toString(),
|
||||
TestFailure::exceptionToString($e)
|
||||
)
|
||||
TestFailure::exceptionToString($e),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ final class MethodNameConstraint extends Constraint
|
||||
{
|
||||
return sprintf(
|
||||
'is "%s"',
|
||||
$this->methodName
|
||||
$this->methodName,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ final class MockBuilder
|
||||
* @throws \PHPUnit\Framework\InvalidArgumentException
|
||||
* @throws ClassAlreadyExistsException
|
||||
* @throws ClassIsFinalException
|
||||
* @throws ClassIsReadonlyException
|
||||
* @throws DuplicateMethodException
|
||||
* @throws InvalidMethodNameException
|
||||
* @throws OriginalConstructorInvocationRequiredException
|
||||
@@ -137,7 +138,7 @@ final class MockBuilder
|
||||
$this->callOriginalMethods,
|
||||
$this->proxyTarget,
|
||||
$this->allowMockingUnknownTypes,
|
||||
$this->returnValueGeneration
|
||||
$this->returnValueGeneration,
|
||||
);
|
||||
|
||||
$this->testCase->registerMockObject($object);
|
||||
@@ -164,7 +165,7 @@ final class MockBuilder
|
||||
$this->originalClone,
|
||||
$this->autoload,
|
||||
$this->methods,
|
||||
$this->cloneArguments
|
||||
$this->cloneArguments,
|
||||
);
|
||||
|
||||
$this->testCase->registerMockObject($object);
|
||||
@@ -191,7 +192,7 @@ final class MockBuilder
|
||||
$this->originalClone,
|
||||
$this->autoload,
|
||||
$this->methods,
|
||||
$this->cloneArguments
|
||||
$this->cloneArguments,
|
||||
);
|
||||
|
||||
$this->testCase->registerMockObject($object);
|
||||
@@ -241,8 +242,8 @@ final class MockBuilder
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -283,8 +284,8 @@ final class MockBuilder
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@@ -312,8 +313,8 @@ final class MockBuilder
|
||||
return $this->setMethods(
|
||||
array_diff(
|
||||
$this->generator->getClassMethods($this->type),
|
||||
$methods
|
||||
)
|
||||
$methods,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ final class MockClass implements MockType
|
||||
$this->mockName,
|
||||
'__phpunit_initConfigurableMethods',
|
||||
],
|
||||
...$this->configurableMethods
|
||||
...$this->configurableMethods,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ final class MockMethod
|
||||
$reference,
|
||||
$callOriginalMethod,
|
||||
$method->isStatic(),
|
||||
$deprecation
|
||||
$deprecation,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ final class MockMethod
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
null
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -191,12 +191,12 @@ final class MockMethod
|
||||
} elseif ($this->returnType->isNever() || $this->returnType->isVoid()) {
|
||||
$templateFile = sprintf(
|
||||
'%s_method_never_or_void.tpl',
|
||||
$this->callOriginalMethod ? 'proxied' : 'mocked'
|
||||
$this->callOriginalMethod ? 'proxied' : 'mocked',
|
||||
);
|
||||
} else {
|
||||
$templateFile = sprintf(
|
||||
'%s_method.tpl',
|
||||
$this->callOriginalMethod ? 'proxied' : 'mocked'
|
||||
$this->callOriginalMethod ? 'proxied' : 'mocked',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ final class MockMethod
|
||||
$deprecationTemplate->setVar(
|
||||
[
|
||||
'deprecation' => var_export($deprecation, true),
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
$deprecation = $deprecationTemplate->render();
|
||||
@@ -230,7 +230,7 @@ final class MockMethod
|
||||
'reference' => $this->reference,
|
||||
'clone_arguments' => $this->cloneArguments ? 'true' : 'false',
|
||||
'deprecation' => $deprecation,
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
return $template->render();
|
||||
@@ -254,8 +254,8 @@ final class MockMethod
|
||||
} catch (TemplateException $e) {
|
||||
throw new RuntimeException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -361,18 +361,18 @@ final class MockMethod
|
||||
substr(
|
||||
substr(
|
||||
$parameterAsString,
|
||||
strpos($parameterAsString, '<optional> ') + strlen('<optional> ')
|
||||
strpos($parameterAsString, '<optional> ') + strlen('<optional> '),
|
||||
),
|
||||
0,
|
||||
-2
|
||||
)
|
||||
-2,
|
||||
),
|
||||
)[1];
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ReflectionException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
$e->getCode(),
|
||||
$e,
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
+8
-6
@@ -21,6 +21,8 @@ use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
|
||||
|
||||
/**
|
||||
* @internal This class is not covered by the backward compatibility promise for PHPUnit
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
final class ConsecutiveParameters implements ParametersRule
|
||||
{
|
||||
@@ -45,8 +47,8 @@ final class ConsecutiveParameters implements ParametersRule
|
||||
sprintf(
|
||||
'Parameter group #%d must be an array or Traversable, got %s',
|
||||
$index,
|
||||
gettype($parameters)
|
||||
)
|
||||
gettype($parameters),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -109,8 +111,8 @@ final class ConsecutiveParameters implements ParametersRule
|
||||
throw new ExpectationFailedException(
|
||||
sprintf(
|
||||
'Parameter count for invocation %s is too low.',
|
||||
$invocation->toString()
|
||||
)
|
||||
$invocation->toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -122,8 +124,8 @@ final class ConsecutiveParameters implements ParametersRule
|
||||
'value.',
|
||||
$i,
|
||||
$callIndex,
|
||||
$invocation->toString()
|
||||
)
|
||||
$invocation->toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -64,8 +64,8 @@ final class InvokedAtIndex extends InvocationOrder
|
||||
throw new ExpectationFailedException(
|
||||
sprintf(
|
||||
'The expected invocation at index %s was never reached.',
|
||||
$this->sequenceIndex
|
||||
)
|
||||
$this->sequenceIndex,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user