Update besar apk finance

This commit is contained in:
Wian Drs
2026-09-11 16:03:00 +07:00
parent d42483b350
commit 4ef15c22ae
897 changed files with 98056 additions and 15979 deletions
+36
View File
@@ -2,6 +2,37 @@
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.36] - 2026-08-11
### Changed
* Use `spl_object_id()` instead of `spl_object_hash()` (which will be deprecated in PHP 8.6)
* Use the error suppression operator (`@`) when calling `DeepCopy\DeepCopy::copy()` because it uses `spl_object_hash()` (which will be deprecated in PHP 8.6)
## [9.6.35] - 2026-07-06
### Changed
* [#6797](https://github.com/sebastianbergmann/phpunit/issues/6797): Adapt code generated for test double of interface with constructor for PHP 8.6
## [9.6.34] - 2026-01-27
### Fixed
* Regression introduced in PHPUnit 9.6.33
## [9.6.33] - 2026-01-27
### Changed
* To prevent Poisoned Pipeline Execution (PPE) attacks using prepared `.coverage` files in pull requests, a PHPT test will no longer be run if the temporary file for writing code coverage information already exists before the test runs
## [9.6.32] - 2026-01-24
### Changed
* `PHPUnit\Framework\MockObject` exceptions are now subtypes of `PHPUnit\Exception`
## [9.6.31] - 2025-12-06
* No changes; `phpunit.phar` rebuilt with PHP 8.4 to work around PHP-Scoper issue [#1139](https://github.com/humbug/php-scoper/issues/1139)
@@ -212,6 +243,11 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil
* [#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.36]: https://github.com/sebastianbergmann/phpunit/compare/9.6.35...9.6.36
[9.6.35]: https://github.com/sebastianbergmann/phpunit/compare/9.6.34...9.6.35
[9.6.34]: https://github.com/sebastianbergmann/phpunit/compare/9.6.33...9.6.34
[9.6.33]: https://github.com/sebastianbergmann/phpunit/compare/9.6.32...9.6.33
[9.6.32]: https://github.com/sebastianbergmann/phpunit/compare/9.6.31...9.6.32
[9.6.31]: https://github.com/sebastianbergmann/phpunit/compare/9.6.30...9.6.31
[9.6.30]: https://github.com/sebastianbergmann/phpunit/compare/9.6.29...9.6.30
[9.6.29]: https://github.com/sebastianbergmann/phpunit/compare/9.6.28...9.6.29
+1 -1
View File
@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2001-2025, Sebastian Bergmann
Copyright (c) 2001-2026, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without
+84 -10
View File
@@ -1,12 +1,36 @@
# Security Policy
If you believe you have found a security vulnerability in PHPUnit, please report it to us through coordinated disclosure.
## Supported versions
Security issues are fixed for versions of PHPUnit that are in the Bugfix Support phase.
Versions in the Life Support phase only receive changes required for compatibility with new versions of PHP; they do not receive bug or security fixes.
Versions that have reached End-of-Life do not receive any changes.
| Version | Phase | End of Bugfix Support |
|------------|----------------|-----------------------|
| PHPUnit 13 | Bugfix Support | February 4, 2028 |
| PHPUnit 12 | Bugfix Support | February 5, 2027 |
| PHPUnit 11 | Life Support | February 6, 2026 |
| PHPUnit 10 | Life Support | February 7, 2025 |
| PHPUnit 9 | Life Support | February 2, 2024 |
| PHPUnit 8 | Life Support | February 3, 2023 |
PHPUnit 7 and earlier have reached End-of-Life.
See [Supported Versions of PHPUnit](https://phpunit.de/supported-versions.html) for the authoritative list and for the definitions of the support phases.
## Reporting a vulnerability
If you believe you have found a security vulnerability in PHPUnit, please report it to me through coordinated disclosure.
Please report vulnerabilities in bundled libraries to their respective repositories.
**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:
Use my [PGP key](https://sebastian-bergmann.de/gpg.asc) for encrypted email, for example when your report includes proof-of-concept exploits against third-party systems.
Please include as much of the information listed below as you can to help me better understand and resolve the issue:
* The type of issue
* Full paths of source file(s) related to the manifestation of the issue
@@ -16,18 +40,68 @@ Please include as much of the information listed below as you can to help us bet
* 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.
This information will help me triage your report more quickly.
## Web Context
If you used an AI assistant (LLM, coding agent, or similar) to find, reproduce, or write up the issue, please say so and describe how it was used.
This does not disqualify a report, but it changes how I triage it.
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.
## How reports are handled
**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.**
I do not operate a bug bounty program.
There is no monetary reward for reporting a vulnerability.
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?ref=phpunit)
I will acknowledge receipt of a vulnerability report within 7 days.
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.
A confirmed security issue is handled like any other bug.
It is not prioritized ahead of other work.
It is fixed when I have the time to fix it.
I will fix and release before a public advisory is published, but I will not agree to fixed-date embargoes, multi-vendor coordination, or NDAs.
I do not optimize for metrics such as the OpenSSF Scorecard.
Once a vulnerability has been fixed and a release with the fix is available, I publish a public advisory on GitHub.
I give credit in the advisory when I know the reporter's GitHub user name.
## Scope
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.
PHPUnit is developed with a focus on development environments and the command-line.
### In scope
I treat a bug as a security issue when a documented, intended use of PHPUnit, or a reasonable extrapolation of it, causes PHPUnit itself to compromise the confidentiality, integrity, or availability of the environment it runs in. Examples:
* PHPUnit's console output, logfiles, and reports in any format contain a vulnerability that allows an attacker to extract secrets from or otherwise compromise the environment in which the output is viewed or processed.
* A regular test run, against trusted test code, trusted production code, and a trusted configuration, causes PHPUnit to transmit data from the environment to a third party.
* A regular test run, against trusted test code, trusted production code, and a trusted configuration, causes PHPUnit to write secrets from the environment to its own output, log files, or reports.
### Not in scope
No specific testing or hardening with regard to using PHPUnit in an HTTP or web context, in a CI/CD context, or with untrusted input data is performed.
The following classes of issue are explicitly not in scope.
#### CI/CD Pipelines
Running tests in a CI/CD pipeline is a legitimate and common use of PHPUnit.
However, a CI/CD pipeline is not a sandbox, and PHPUnit is not designed to defend one.
Executing test code, production code, or a configuration for PHPUnit or PHP that has not been reviewed is equivalent to executing arbitrary code on the infrastructure that hosts the pipeline.
This class of risk is documented as [CICD-SEC-04: Poisoned Pipeline Execution](https://owasp.org/www-project-top-10-ci-cd-security-risks/CICD-SEC-04-Poisoned-Pipeline-Execution) in the OWASP Top 10 CI/CD Security Risks.
**If your CI/CD pipeline automatically runs PHPUnit against a configuration for PHPUnit or PHP, test code, and/or production code from third parties without those changes having been reviewed first, then your development process is broken.**
Running code from a pull request on your infrastructure is, by definition, remote code execution.
Protecting the pipeline is the responsibility of the operator of the pipeline:
limit which events trigger workflows, require review before workflows run on contributions from outside collaborators, isolate jobs that run untrusted code, and do not expose secrets to such jobs.
#### Webserver
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.
PHPUnit might contain functionality that intentionally exposes internal application data for debugging purposes.
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.
+20 -3
View File
@@ -16,6 +16,12 @@
"role": "lead"
}
],
"funding": [
{
"type": "other",
"url": "https://phpunit.de/sponsoring.html"
}
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy"
@@ -24,10 +30,10 @@
"require": {
"php": ">=7.3",
"ext-dom": "*",
"ext-filter": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"doctrine/instantiator": "^1.5.0 || ^2",
"myclabs/deep-copy": "^1.13.4",
@@ -40,10 +46,10 @@
"phpunit/php-timer": "^5.0.3",
"sebastian/cli-parser": "^1.0.2",
"sebastian/code-unit": "^1.0.8",
"sebastian/comparator": "^4.0.9",
"sebastian/comparator": "^4.0.10",
"sebastian/diff": "^4.0.6",
"sebastian/environment": "^5.1.5",
"sebastian/exporter": "^4.0.8",
"sebastian/exporter": "^4.0.9",
"sebastian/global-state": "^5.0.8",
"sebastian/object-enumerator": "^4.0.4",
"sebastian/resource-operations": "^3.0.4",
@@ -54,6 +60,17 @@
"platform": {
"php": "7.3.0"
},
"policy": {
"malware": {
"audit": "fail"
},
"security-advisory": {
"audit": "fail"
},
"abandoned": {
"audit": "fail"
}
},
"classmap-authoritative": true,
"optimize-autoloader": true,
"sort-packages": true
+26 -31
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "2bf92980419fc7b753cc15c2cf7d7e4f",
"content-hash": "954916c0d1b2f7a15e01747dfcf52065",
"packages": [
{
"name": "doctrine/instantiator",
@@ -138,16 +138,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.19.4",
"version": "v4.19.5",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "715f4d25e225bc47b293a8b997fe6ce99bf987d2"
"reference": "51bd93cc741b7fc3d63d20b6bdcd99fdaa359837"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/715f4d25e225bc47b293a8b997fe6ce99bf987d2",
"reference": "715f4d25e225bc47b293a8b997fe6ce99bf987d2",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/51bd93cc741b7fc3d63d20b6bdcd99fdaa359837",
"reference": "51bd93cc741b7fc3d63d20b6bdcd99fdaa359837",
"shasum": ""
},
"require": {
@@ -162,11 +162,6 @@
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.9-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
@@ -188,9 +183,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.19.4"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.19.5"
},
"time": "2024-09-29T15:01:53+00:00"
"time": "2025-12-06T11:45:25+00:00"
},
{
"name": "phar-io/manifest",
@@ -798,16 +793,16 @@
},
{
"name": "sebastian/comparator",
"version": "4.0.9",
"version": "4.0.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5"
"reference": "e4df00b9b3571187db2831ae9aada2c6efbd715d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5",
"reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e4df00b9b3571187db2831ae9aada2c6efbd715d",
"reference": "e4df00b9b3571187db2831ae9aada2c6efbd715d",
"shasum": ""
},
"require": {
@@ -860,7 +855,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/4.0.9"
"source": "https://github.com/sebastianbergmann/comparator/tree/4.0.10"
},
"funding": [
{
@@ -880,7 +875,7 @@
"type": "tidelift"
}
],
"time": "2025-08-10T06:51:50+00:00"
"time": "2026-01-24T09:22:56+00:00"
},
{
"name": "sebastian/complexity",
@@ -1070,16 +1065,16 @@
},
{
"name": "sebastian/exporter",
"version": "4.0.8",
"version": "4.0.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c"
"reference": "4352c1a3df741a7ba9e61af6fed51d1fee41cbf7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/14c6ba52f95a36c3d27c835d65efc7123c446e8c",
"reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/4352c1a3df741a7ba9e61af6fed51d1fee41cbf7",
"reference": "4352c1a3df741a7ba9e61af6fed51d1fee41cbf7",
"shasum": ""
},
"require": {
@@ -1135,7 +1130,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.8"
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.9"
},
"funding": [
{
@@ -1155,7 +1150,7 @@
"type": "tidelift"
}
],
"time": "2025-09-24T06:03:27+00:00"
"time": "2026-08-11T04:55:59+00:00"
},
{
"name": "sebastian/global-state",
@@ -1404,16 +1399,16 @@
},
{
"name": "sebastian/recursion-context",
"version": "4.0.6",
"version": "4.0.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "539c6691e0623af6dc6f9c20384c120f963465a0"
"reference": "c85be6922b7fd365942b986b9a50397d65407611"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0",
"reference": "539c6691e0623af6dc6f9c20384c120f963465a0",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/c85be6922b7fd365942b986b9a50397d65407611",
"reference": "c85be6922b7fd365942b986b9a50397d65407611",
"shasum": ""
},
"require": {
@@ -1455,7 +1450,7 @@
"homepage": "https://github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.6"
"source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.7"
},
"funding": [
{
@@ -1475,7 +1470,7 @@
"type": "tidelift"
}
],
"time": "2025-08-10T06:57:39+00:00"
"time": "2026-08-11T05:25:24+00:00"
},
{
"name": "sebastian/resource-operations",
@@ -1700,10 +1695,10 @@
"platform": {
"php": ">=7.3",
"ext-dom": "*",
"ext-filter": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*"
},
"platform-dev": {},
+1 -1
View File
@@ -38,7 +38,7 @@ if (version_compare('7.3.0', PHP_VERSION, '>')) {
die(1);
}
$requiredExtensions = ['dom', 'json', 'libxml', 'mbstring', 'tokenizer', 'xml', 'xmlwriter'];
$requiredExtensions = ['dom', 'filter', 'json', 'libxml', 'mbstring', 'tokenizer', 'xmlwriter'];
$unavailableExtensions = array_filter(
$requiredExtensions,
+1 -1
View File
@@ -12,7 +12,7 @@ namespace PHPUnit;
use Throwable;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Exception extends Throwable
{
+2 -2
View File
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework;
use const PHP_VERSION_ID;
use function array_keys;
use function get_class;
use function spl_object_hash;
use function spl_object_id;
use PHPUnit\Util\Filter;
use Throwable;
use WeakReference;
@@ -120,7 +120,7 @@ final class ExceptionWrapper extends Exception
if (PHP_VERSION_ID < 70400) {
static $originalExceptions;
$instanceId = spl_object_hash($this);
$instanceId = spl_object_id($this);
if ($exceptionToStore) {
$originalExceptions[$instanceId] = $exceptionToStore;
+1 -1
View File
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework;
use Throwable;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface IncompleteTest extends Throwable
{
@@ -10,7 +10,7 @@
namespace PHPUnit\Framework\MockObject\Builder;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Identity
{
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\MockObject\Builder;
use PHPUnit\Framework\Constraint\Constraint;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface MethodNameMatch extends ParametersMatch
{
@@ -10,7 +10,7 @@
namespace PHPUnit\Framework\MockObject\Builder;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface ParametersMatch extends Stub
{
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\MockObject\Builder;
use PHPUnit\Framework\MockObject\Stub\Stub as BaseStub;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Stub extends Identity
{
@@ -9,11 +9,9 @@
*/
namespace PHPUnit\Framework\MockObject;
use Throwable;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Exception extends Throwable
interface Exception extends \PHPUnit\Exception
{
}
@@ -19,6 +19,7 @@ use function preg_replace;
use function sprintf;
use function strlen;
use function strpos;
use function strtolower;
use function substr;
use function substr_count;
use function trim;
@@ -188,7 +189,7 @@ final class MockMethod
{
if ($this->static) {
$templateFile = 'mocked_static_method.tpl';
} elseif ($this->returnType->isNever() || $this->returnType->isVoid()) {
} elseif ($this->returnType->isNever() || $this->returnType->isVoid() || $this->mustNotReturnValue()) {
$templateFile = sprintf(
'%s_method_never_or_void.tpl',
$this->callOriginalMethod ? 'proxied' : 'mocked',
@@ -263,6 +264,16 @@ final class MockMethod
return self::$templates[$filename];
}
/**
* @see https://wiki.php.net/rfc/deprecate-return-value-from-construct
*/
private function mustNotReturnValue(): bool
{
$methodName = strtolower($this->methodName);
return $methodName === '__construct' || $methodName === '__destruct';
}
/**
* Returns the parameters of a function or method.
*
@@ -10,7 +10,7 @@
namespace PHPUnit\Framework\MockObject;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface MockType
{
@@ -13,7 +13,7 @@ use PHPUnit\Framework\MockObject\Invocation;
use PHPUnit\Framework\SelfDescribing;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Stub extends SelfDescribing
{
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\MockObject;
use PHPUnit\Framework\ExpectationFailedException;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Verifiable
{
+1 -1
View File
@@ -10,7 +10,7 @@
namespace PHPUnit\Framework;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Reorderable
{
+1 -1
View File
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework;
use Throwable;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface SkippedTest extends Throwable
{
+2 -1
View File
@@ -2208,7 +2208,8 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
$deepCopy = new DeepCopy;
$deepCopy->skipUncloneable(false);
$this->dependencyInput[$dependencyTarget] = $deepCopy->copy($passed[$dependencyTarget]['result']);
// The diagnostics are suppressed because myclabs/deep-copy uses spl_object_hash(), which is deprecated since PHP 8.6
$this->dependencyInput[$dependencyTarget] = @$deepCopy->copy($passed[$dependencyTarget]['result']);
} elseif ($dependency->useShallowClone()) {
$this->dependencyInput[$dependencyTarget] = clone $passed[$dependencyTarget]['result'];
} else {
@@ -16,8 +16,8 @@ use function in_array;
*/
final class ExcludeGroupFilterIterator extends GroupFilterIterator
{
protected function doAccept(string $hash): bool
protected function doAccept(int $id): bool
{
return !in_array($hash, $this->groupTests, true);
return !in_array($id, $this->groupTests, true);
}
}
@@ -12,7 +12,7 @@ namespace PHPUnit\Runner\Filter;
use function array_map;
use function array_merge;
use function in_array;
use function spl_object_hash;
use function spl_object_id;
use PHPUnit\Framework\TestSuite;
use RecursiveFilterIterator;
use RecursiveIterator;
@@ -23,7 +23,7 @@ use RecursiveIterator;
abstract class GroupFilterIterator extends RecursiveFilterIterator
{
/**
* @var string[]
* @var int[]
*/
protected $groupTests = [];
@@ -33,12 +33,12 @@ abstract class GroupFilterIterator extends RecursiveFilterIterator
foreach ($suite->getGroupDetails() as $group => $tests) {
if (in_array((string) $group, $groups, true)) {
$testHashes = array_map(
'spl_object_hash',
$testIds = array_map(
'spl_object_id',
$tests,
);
$this->groupTests = array_merge($this->groupTests, $testHashes);
$this->groupTests = array_merge($this->groupTests, $testIds);
}
}
}
@@ -51,8 +51,8 @@ abstract class GroupFilterIterator extends RecursiveFilterIterator
return true;
}
return $this->doAccept(spl_object_hash($test));
return $this->doAccept(spl_object_id($test));
}
abstract protected function doAccept(string $hash);
abstract protected function doAccept(int $id);
}
@@ -16,8 +16,8 @@ use function in_array;
*/
final class IncludeGroupFilterIterator extends GroupFilterIterator
{
protected function doAccept(string $hash): bool
protected function doAccept(int $id): bool
{
return in_array($hash, $this->groupTests, true);
return in_array($id, $this->groupTests, true);
}
}
+47 -10
View File
@@ -19,6 +19,7 @@ use function dirname;
use function explode;
use function extension_loaded;
use function file;
use function file_exists;
use function file_get_contents;
use function file_put_contents;
use function is_array;
@@ -89,17 +90,13 @@ final class PhptTestCase implements Reorderable, SelfDescribing, Test
*/
public function __construct(string $filename, ?AbstractPhpProcess $phpUtil = null)
{
if (!is_file($filename)) {
throw new Exception(
sprintf(
'File "%s" does not exist.',
$filename,
),
);
}
$this->ensureFileExists($filename);
$this->filename = $filename;
$this->phpUtil = $phpUtil ?: AbstractPhpProcess::factory();
$this->ensureCoverageFileDoesNotExist();
$this->phpUtil = $phpUtil ?: AbstractPhpProcess::factory();
}
/**
@@ -657,7 +654,14 @@ final class PhptTestCase implements Reorderable, SelfDescribing, Test
$buffer = @file_get_contents($files['coverage']);
if ($buffer !== false) {
$coverage = @unserialize($buffer);
$coverage = @unserialize(
$buffer,
[
'allowed_classes' => [
RawCodeCoverageData::class,
],
],
);
if ($coverage === false) {
$coverage = RawCodeCoverageData::fromXdebugWithoutPathCoverage([]);
@@ -862,4 +866,37 @@ final class PhptTestCase implements Reorderable, SelfDescribing, Test
return $settings;
}
/**
* @throws Exception
*/
private function ensureFileExists(string $filename): void
{
if (!is_file($filename)) {
throw new Exception(
sprintf(
'File "%s" does not exist.',
$filename,
),
);
}
}
/**
* @throws Exception
*/
private function ensureCoverageFileDoesNotExist(): void
{
$files = $this->getCoverageFiles();
if (file_exists($files['coverage'])) {
throw new Exception(
sprintf(
'File %s exists, PHPT test %s will not be executed',
$files['coverage'],
$this->filename,
),
);
}
}
}
+1 -1
View File
@@ -10,7 +10,7 @@
namespace PHPUnit\Runner;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface TestResultCache
{
+1 -1
View File
@@ -44,7 +44,7 @@ final class Version
}
if (self::$version === '') {
self::$version = (new VersionId('9.6.31', dirname(__DIR__, 2)))->getVersion();
self::$version = (new VersionId('9.6.36', dirname(__DIR__, 2)))->getVersion();
assert(!empty(self::$version));
}
@@ -12,7 +12,7 @@ namespace PHPUnit\TextUI\XmlConfiguration;
use DOMDocument;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Migration
{
+5 -5
View File
@@ -86,14 +86,14 @@ final class DocBlock
/**
* @var null|array<string, mixed>
*
* @psalm-var null|(array{
* @psalm-var null|(array<
* string,
* array<int|string, string>|array{constraint: string}|array{version: string, operator: string}|string
* >&array{
* __OFFSET: array<string, int>&array{__FILE: string},
* setting?: array<string, string>,
* extension_versions?: array<string, array{version: string, operator: string}>
* }&array<
* string,
* string|array{version: string, operator: string}|array{constraint: string}|array<int|string, string>
* >)
* })
*/
private $parsedRequirements;
@@ -20,7 +20,7 @@ use function sprintf;
final class VersionComparisonOperator
{
/**
* @psalm-var '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne'
* @psalm-var '!='|'<'|'<='|'<>'|'='|'=='|'>'|'>='|'eq'|'ge'|'gt'|'le'|'lt'|'ne'
*/
private $operator;