update patch 1
This commit is contained in:
+7
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes of the PHPUnit 11.4 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [11.4.4] - 2024-11-27
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#6028](https://github.com/sebastianbergmann/phpunit/issues/6028): `ignoreIndirectDeprecations=true` suppresses deprecations triggered in test code
|
||||
|
||||
## [11.4.3] - 2024-10-28
|
||||
|
||||
### Changed
|
||||
@@ -55,6 +61,7 @@ All notable changes of the PHPUnit 11.4 release series are documented in this fi
|
||||
* [#5958](https://github.com/sebastianbergmann/phpunit/issues/5958): Support for `#[CoversTrait]` and `#[UsesTrait]` attributes
|
||||
* [#5960](https://github.com/sebastianbergmann/phpunit/issues/5960): Support for targeting trait methods with the `#[CoversMethod]` and `#[UsesMethod]` attributes (and respective annotations)
|
||||
|
||||
[11.4.4]: https://github.com/sebastianbergmann/phpunit/compare/11.4.3...11.4.4
|
||||
[11.4.3]: https://github.com/sebastianbergmann/phpunit/compare/11.4.2...11.4.3
|
||||
[11.4.2]: https://github.com/sebastianbergmann/phpunit/compare/11.4.1...11.4.2
|
||||
[11.4.1]: https://github.com/sebastianbergmann/phpunit/compare/11.4.0...11.4.1
|
||||
|
||||
Vendored
+2
-2
@@ -29,7 +29,7 @@
|
||||
"ext-mbstring": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"myclabs/deep-copy": "^1.12.0",
|
||||
"myclabs/deep-copy": "^1.12.1",
|
||||
"phar-io/manifest": "^2.0.4",
|
||||
"phar-io/version": "^3.2.1",
|
||||
"phpunit/php-code-coverage": "^11.0.7",
|
||||
@@ -39,7 +39,7 @@
|
||||
"phpunit/php-timer": "^7.0.1",
|
||||
"sebastian/cli-parser": "^3.0.2",
|
||||
"sebastian/code-unit": "^3.0.1",
|
||||
"sebastian/comparator": "^6.1.1",
|
||||
"sebastian/comparator": "^6.2.1",
|
||||
"sebastian/diff": "^6.0.2",
|
||||
"sebastian/environment": "^7.2.0",
|
||||
"sebastian/exporter": "^6.1.3",
|
||||
|
||||
+17
-17
@@ -4,20 +4,20 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "58e1faa37b24b6fed22023522c97ae7a",
|
||||
"content-hash": "009761e466af767c127271a46d0f9f53",
|
||||
"packages": [
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.12.0",
|
||||
"version": "1.12.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c"
|
||||
"reference": "123267b2c49fbf30d78a7b2d333f6be754b94845"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
|
||||
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845",
|
||||
"reference": "123267b2c49fbf30d78a7b2d333f6be754b94845",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -56,7 +56,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.0"
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -64,7 +64,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-06-12T14:39:25+00:00"
|
||||
"time": "2024-11-08T17:47:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
@@ -737,16 +737,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
"version": "6.1.1",
|
||||
"version": "6.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||
"reference": "5ef523a49ae7a302b87b2102b72b1eda8918d686"
|
||||
"reference": "43d129d6a0f81c78bee378b46688293eb7ea3739"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5ef523a49ae7a302b87b2102b72b1eda8918d686",
|
||||
"reference": "5ef523a49ae7a302b87b2102b72b1eda8918d686",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739",
|
||||
"reference": "43d129d6a0f81c78bee378b46688293eb7ea3739",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -757,12 +757,12 @@
|
||||
"sebastian/exporter": "^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^11.3"
|
||||
"phpunit/phpunit": "^11.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "6.1-dev"
|
||||
"dev-main": "6.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -802,7 +802,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/comparator/issues",
|
||||
"security": "https://github.com/sebastianbergmann/comparator/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/comparator/tree/6.1.1"
|
||||
"source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -810,7 +810,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-10-18T15:00:48+00:00"
|
||||
"time": "2024-10-31T05:30:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/complexity",
|
||||
@@ -1542,7 +1542,7 @@
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
@@ -1554,7 +1554,7 @@
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"platform-dev": {},
|
||||
"platform-overrides": {
|
||||
"php": "8.2.0"
|
||||
},
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@ namespace PHPUnit\Event\Test;
|
||||
|
||||
use const PHP_EOL;
|
||||
use function sprintf;
|
||||
use PHPUnit\Event\Code;
|
||||
use PHPUnit\Event\Code\ClassMethod;
|
||||
use PHPUnit\Event\Event;
|
||||
use PHPUnit\Event\Telemetry;
|
||||
@@ -49,7 +48,7 @@ final readonly class DataProviderMethodFinished implements Event
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<Code\ClassMethod>
|
||||
* @return list<ClassMethod>
|
||||
*/
|
||||
public function calledMethods(): array
|
||||
{
|
||||
|
||||
@@ -16,6 +16,11 @@ namespace PHPUnit\Event\Code\IssueTrigger;
|
||||
*/
|
||||
abstract class IssueTrigger
|
||||
{
|
||||
public static function test(): TestTrigger
|
||||
{
|
||||
return new TestTrigger;
|
||||
}
|
||||
|
||||
public static function self(): SelfTrigger
|
||||
{
|
||||
return new SelfTrigger;
|
||||
@@ -40,6 +45,16 @@ abstract class IssueTrigger
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Your test code triggers an issue.
|
||||
*
|
||||
* @phpstan-assert-if-true TestTrigger $this
|
||||
*/
|
||||
public function isTest(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Your own code triggers an issue in your own code.
|
||||
*
|
||||
|
||||
+6
-4
@@ -195,6 +195,8 @@ abstract class Assert
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-assert list<mixed> $array
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
*/
|
||||
final public static function assertIsList(mixed $array, string $message = ''): void
|
||||
@@ -1196,7 +1198,7 @@ abstract class Assert
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @phpstan-assert array $actual
|
||||
* @phpstan-assert array<mixed> $actual
|
||||
*/
|
||||
final public static function assertIsArray(mixed $actual, string $message = ''): void
|
||||
{
|
||||
@@ -1383,7 +1385,7 @@ abstract class Assert
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @phpstan-assert iterable $actual
|
||||
* @phpstan-assert iterable<mixed> $actual
|
||||
*/
|
||||
final public static function assertIsIterable(mixed $actual, string $message = ''): void
|
||||
{
|
||||
@@ -1400,7 +1402,7 @@ abstract class Assert
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @phpstan-assert !array $actual
|
||||
* @phpstan-assert !array<mixed> $actual
|
||||
*/
|
||||
final public static function assertIsNotArray(mixed $actual, string $message = ''): void
|
||||
{
|
||||
@@ -1587,7 +1589,7 @@ abstract class Assert
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @phpstan-assert !iterable $actual
|
||||
* @phpstan-assert !iterable<mixed> $actual
|
||||
*/
|
||||
final public static function assertIsNotIterable(mixed $actual, string $message = ''): void
|
||||
{
|
||||
|
||||
+11
-6
@@ -193,6 +193,8 @@ if (!function_exists('PHPUnit\Framework\assertArrayNotHasKey')) {
|
||||
|
||||
if (!function_exists('PHPUnit\Framework\assertIsList')) {
|
||||
/**
|
||||
* @phpstan-assert list<mixed> $array
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
@@ -279,7 +281,8 @@ if (!function_exists('PHPUnit\Framework\assertContainsOnly')) {
|
||||
/**
|
||||
* Asserts that a haystack contains only values of a given type.
|
||||
*
|
||||
* @param iterable<mixed> $haystack
|
||||
* @param 'array'|'bool'|'boolean'|'callable'|'double'|'float'|'int'|'integer'|'iterable'|'null'|'numeric'|'object'|'real'|'resource (closed)'|'resource'|'scalar'|'string' $type
|
||||
* @param iterable<mixed> $haystack
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
@@ -298,6 +301,7 @@ if (!function_exists('PHPUnit\Framework\assertContainsOnlyInstancesOf')) {
|
||||
/**
|
||||
* Asserts that a haystack contains only instances of a given class name.
|
||||
*
|
||||
* @param class-string $className
|
||||
* @param iterable<mixed> $haystack
|
||||
*
|
||||
* @throws Exception
|
||||
@@ -317,7 +321,8 @@ if (!function_exists('PHPUnit\Framework\assertNotContainsOnly')) {
|
||||
/**
|
||||
* Asserts that a haystack does not contain only values of a given type.
|
||||
*
|
||||
* @param iterable<mixed> $haystack
|
||||
* @param 'array'|'bool'|'boolean'|'callable'|'double'|'float'|'int'|'integer'|'iterable'|'null'|'numeric'|'object'|'real'|'resource (closed)'|'resource'|'scalar'|'string' $type
|
||||
* @param iterable<mixed> $haystack
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
@@ -1374,7 +1379,7 @@ if (!function_exists('PHPUnit\Framework\assertIsArray')) {
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @phpstan-assert array $actual
|
||||
* @phpstan-assert array<mixed> $actual
|
||||
*
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
*
|
||||
@@ -1583,7 +1588,7 @@ if (!function_exists('PHPUnit\Framework\assertIsIterable')) {
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @phpstan-assert iterable $actual
|
||||
* @phpstan-assert iterable<mixed> $actual
|
||||
*
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
*
|
||||
@@ -1602,7 +1607,7 @@ if (!function_exists('PHPUnit\Framework\assertIsNotArray')) {
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @phpstan-assert !array $actual
|
||||
* @phpstan-assert !array<mixed> $actual
|
||||
*
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
*
|
||||
@@ -1811,7 +1816,7 @@ if (!function_exists('PHPUnit\Framework\assertIsNotIterable')) {
|
||||
* @throws Exception
|
||||
* @throws ExpectationFailedException
|
||||
*
|
||||
* @phpstan-assert !iterable $actual
|
||||
* @phpstan-assert !iterable<mixed> $actual
|
||||
*
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
*
|
||||
|
||||
@@ -42,7 +42,7 @@ final class IsEqual extends Constraint
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
*/
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): bool
|
||||
{
|
||||
// If $this->value and $other are identical, they are also equal.
|
||||
// This is the most common path and will allow us to skip
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ final class IsEqualCanonicalizing extends Constraint
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
*/
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): bool
|
||||
{
|
||||
// If $this->value and $other are identical, they are also equal.
|
||||
// This is the most common path and will allow us to skip
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ final class IsEqualIgnoringCase extends Constraint
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
*/
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): bool
|
||||
{
|
||||
// If $this->value and $other are identical, they are also equal.
|
||||
// This is the most common path and will allow us to skip
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ final class IsEqualWithDelta extends Constraint
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
*/
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): bool
|
||||
{
|
||||
// If $this->value and $other are identical, they are also equal.
|
||||
// This is the most common path and will allow us to skip
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
namespace PHPUnit\Framework\Constraint;
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
/**
|
||||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
|
||||
*/
|
||||
@@ -25,8 +23,6 @@ final class IsAnything extends Constraint
|
||||
* If $returnResult is true, the result of the evaluation is returned as
|
||||
* a boolean value instead: true in case of success, false in case of a
|
||||
* failure.
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
*/
|
||||
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
|
||||
{
|
||||
|
||||
@@ -128,7 +128,6 @@ final class IsType extends Constraint
|
||||
*/
|
||||
public function __construct(string $type)
|
||||
{
|
||||
/** @phpstan-ignore isset.offset */
|
||||
if (!isset(self::KNOWN_TYPES[$type])) {
|
||||
throw new UnknownTypeException($type);
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ final class Generator
|
||||
|
||||
try {
|
||||
$client = new SoapClient($wsdlFile, $options);
|
||||
$_methods = array_unique($client->__getFunctions());
|
||||
$_methods = array_unique($client->__getFunctions() ?? []);
|
||||
|
||||
unset($client);
|
||||
} catch (SoapFault $e) {
|
||||
@@ -776,7 +776,7 @@ final class Generator
|
||||
|
||||
if (is_array($explicitMethods)) {
|
||||
foreach ($explicitMethods as $methodName) {
|
||||
if ($class !== null && $class->hasMethod($methodName)) {
|
||||
if ($class->hasMethod($methodName)) {
|
||||
$method = $class->getMethod($methodName);
|
||||
|
||||
if ($this->canMethodBeDoubled($method)) {
|
||||
@@ -811,7 +811,9 @@ final class Generator
|
||||
}
|
||||
|
||||
/** @var trait-string[] $traits */
|
||||
$traits = [];
|
||||
$traits = [];
|
||||
|
||||
/** @phpstan-ignore identical.alwaysTrue */
|
||||
$isPhp82 = PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION === 2;
|
||||
|
||||
if (!$isReadonly && $isPhp82) {
|
||||
@@ -1099,7 +1101,7 @@ final class Generator
|
||||
*
|
||||
* @throws ReflectionException
|
||||
*
|
||||
* @phpstan-ignore missingType.generics
|
||||
* @phpstan-ignore missingType.generics, throws.unusedType
|
||||
*/
|
||||
private function reflectClass(string $className): ReflectionClass
|
||||
{
|
||||
|
||||
@@ -226,13 +226,13 @@ EOT;
|
||||
'arguments_call' => $this->argumentsForCall,
|
||||
'return_declaration' => !empty($this->returnType->asString()) ? (': ' . $this->returnType->asString()) : '',
|
||||
'return_type' => $this->returnType->asString(),
|
||||
'arguments_count' => $argumentsCount,
|
||||
'arguments_count' => (string) $argumentsCount,
|
||||
'class_name' => $this->className,
|
||||
'method_name' => $this->methodName,
|
||||
'modifier' => $this->modifier,
|
||||
'reference' => $this->reference,
|
||||
'clone_arguments' => $this->cloneArguments ? 'true' : 'false',
|
||||
'deprecation' => $deprecation,
|
||||
'deprecation' => $deprecation ?? '',
|
||||
'return_result' => $returnResult,
|
||||
],
|
||||
);
|
||||
|
||||
+2
-3
@@ -90,7 +90,7 @@ final class Parameters implements ParametersRule
|
||||
}
|
||||
|
||||
if ($this->invocation === null) {
|
||||
throw new ExpectationFailedException('Mocked method does not exist.');
|
||||
throw new ExpectationFailedException('Doubled method does not exist.');
|
||||
}
|
||||
|
||||
if (count($this->invocation->parameters()) < count($this->parameters)) {
|
||||
@@ -119,8 +119,7 @@ final class Parameters implements ParametersRule
|
||||
$parameter->evaluate(
|
||||
$other,
|
||||
sprintf(
|
||||
'Parameter %s for invocation %s does not match expected ' .
|
||||
'value.',
|
||||
'Parameter %s for invocation %s does not match expected value.',
|
||||
$i,
|
||||
$this->invocation->toString(),
|
||||
),
|
||||
|
||||
@@ -2003,7 +2003,6 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
|
||||
set_error_handler($handler);
|
||||
}
|
||||
|
||||
/** @phpstan-ignore if.alwaysFalse */
|
||||
if ($invalidErrorHandlerStack) {
|
||||
$message = 'At least one error handler is not callable outside the scope it was registered in';
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use const PHP_EOL;
|
||||
use function assert;
|
||||
use function extension_loaded;
|
||||
use function sprintf;
|
||||
use function xdebug_is_debugger_active;
|
||||
use AssertionError;
|
||||
use PHPUnit\Event\Facade;
|
||||
use PHPUnit\Metadata\Api\CodeCoverage as CodeCoverageMetadataApi;
|
||||
|
||||
@@ -184,17 +184,11 @@ final class JunitXmlLogger
|
||||
$this->createTestCase($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function testPreparationFailed(): void
|
||||
{
|
||||
$this->preparationFailed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function testPrepared(): void
|
||||
{
|
||||
$this->prepared = true;
|
||||
|
||||
@@ -49,7 +49,7 @@ final class TeamCityLogger
|
||||
private readonly Printer $printer;
|
||||
private bool $isSummaryTestCountPrinted = false;
|
||||
private ?HRTime $time = null;
|
||||
private ?int $flowId;
|
||||
private ?int $flowId = null;
|
||||
|
||||
/**
|
||||
* @throws EventFacadeIsSealedException
|
||||
|
||||
+8
-4
@@ -269,10 +269,14 @@ final class ErrorHandler
|
||||
$triggeredInFirstPartyCode = false;
|
||||
$triggerCalledFromFirstPartyCode = false;
|
||||
|
||||
if (isset($trace[0]['file']) &&
|
||||
($trace[0]['file'] === $test->file() ||
|
||||
$this->sourceFilter->includes($this->source, $trace[0]['file']))) {
|
||||
$triggeredInFirstPartyCode = true;
|
||||
if (isset($trace[0]['file'])) {
|
||||
if ($trace[0]['file'] === $test->file()) {
|
||||
return IssueTrigger::test();
|
||||
}
|
||||
|
||||
if ($this->sourceFilter->includes($this->source, $trace[0]['file'])) {
|
||||
$triggeredInFirstPartyCode = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($trace[1]['file']) &&
|
||||
|
||||
+7
-1
@@ -12,6 +12,7 @@ namespace PHPUnit\Runner\Filter;
|
||||
use function assert;
|
||||
use FilterIterator;
|
||||
use Iterator;
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
|
||||
/**
|
||||
@@ -22,7 +23,7 @@ use PHPUnit\Framework\TestSuite;
|
||||
final class Factory
|
||||
{
|
||||
/**
|
||||
* @var list<array{className: class-string, argument: list<non-empty-string>|non-empty-string}>
|
||||
* @var list<array{className: class-string<FilterIterator<int, Test, Iterator<int, Test>>>, argument: list<non-empty-string>|non-empty-string}>
|
||||
*/
|
||||
private array $filters = [];
|
||||
|
||||
@@ -81,6 +82,11 @@ final class Factory
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Iterator<int, Test> $iterator
|
||||
*
|
||||
* @return FilterIterator<int, Test, Iterator<int, Test>>
|
||||
*/
|
||||
public function factory(Iterator $iterator, TestSuite $suite): FilterIterator
|
||||
{
|
||||
foreach ($this->filters as $filter) {
|
||||
|
||||
+2
-1
@@ -44,7 +44,8 @@ final readonly class IssueFilter
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->source->ignoreSelfDeprecations() && $event->trigger()->isSelf()) {
|
||||
if ($this->source->ignoreSelfDeprecations() &&
|
||||
($event->trigger()->isTest() || $event->trigger()->isSelf())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -547,6 +547,7 @@ final class PhptTestCase implements Reorderable, SelfDescribing, Test
|
||||
'EXPECTF',
|
||||
'EXPECTREGEX',
|
||||
];
|
||||
|
||||
$testDirectory = dirname($this->filename) . DIRECTORY_SEPARATOR;
|
||||
|
||||
foreach ($allowSections as $section) {
|
||||
@@ -561,7 +562,11 @@ final class PhptTestCase implements Reorderable, SelfDescribing, Test
|
||||
);
|
||||
}
|
||||
|
||||
$sections[$section] = file_get_contents($testDirectory . $externalFilename);
|
||||
$contents = file_get_contents($testDirectory . $externalFilename);
|
||||
|
||||
assert($contents !== false && $contents !== '');
|
||||
|
||||
$sections[$section] = $contents;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -694,9 +699,11 @@ final class PhptTestCase implements Reorderable, SelfDescribing, Test
|
||||
|
||||
file_put_contents($files['job'], $job);
|
||||
|
||||
$job = $template->render();
|
||||
$rendered = $template->render();
|
||||
|
||||
assert($job !== '');
|
||||
assert($rendered !== '');
|
||||
|
||||
$job = $rendered;
|
||||
}
|
||||
|
||||
private function cleanupForCoverage(): RawCodeCoverageData
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
*/
|
||||
namespace PHPUnit\TestRunner\TestResult\Issues;
|
||||
|
||||
use function array_keys;
|
||||
use function count;
|
||||
use PHPUnit\Event\Code\Test;
|
||||
|
||||
/**
|
||||
@@ -112,4 +114,10 @@ final class Issue
|
||||
{
|
||||
return $this->triggeringTests;
|
||||
}
|
||||
|
||||
public function triggeredInTest(): bool
|
||||
{
|
||||
return count($this->triggeringTests) === 1 &&
|
||||
$this->file === $this->triggeringTests[array_keys($this->triggeringTests)[0]]['test']->file();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ final class Version
|
||||
}
|
||||
|
||||
if (self::$version === '') {
|
||||
self::$version = (new VersionId('11.4.3', dirname(__DIR__, 2)))->asString();
|
||||
self::$version = (new VersionId('11.4.4', dirname(__DIR__, 2)))->asString();
|
||||
}
|
||||
|
||||
return self::$version;
|
||||
|
||||
@@ -41,8 +41,6 @@ final readonly class VersionCheckCommand implements Command
|
||||
|
||||
$latestCompatibleVersion = $this->downloader->download('https://phar.phpunit.de/latest-version-of/phpunit-' . $this->majorVersionNumber);
|
||||
|
||||
assert($latestCompatibleVersion !== false);
|
||||
|
||||
$notLatest = version_compare($latestVersion, $this->versionId, '>');
|
||||
$notLatestCompatible = false;
|
||||
|
||||
|
||||
@@ -1773,7 +1773,7 @@ final readonly class Configuration
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-assert-if-true !null $this->teamcityPrinter
|
||||
* @phpstan-assert-if-true !null $this->teamCityPrinter
|
||||
*/
|
||||
public function hasTeamCityPrinter(): bool
|
||||
{
|
||||
@@ -1915,7 +1915,7 @@ final readonly class Configuration
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-assert-if-true !null $this->excludedTestSuite
|
||||
* @phpstan-assert-if-true !null $this->excludeTestSuite
|
||||
*/
|
||||
public function hasExcludedTestSuite(): bool
|
||||
{
|
||||
|
||||
@@ -141,12 +141,12 @@ final readonly class Configuration
|
||||
/**
|
||||
* @var list<non-empty-string>
|
||||
*/
|
||||
private ?array $groups;
|
||||
private array $groups;
|
||||
|
||||
/**
|
||||
* @var list<non-empty-string>
|
||||
*/
|
||||
private ?array $excludeGroups;
|
||||
private array $excludeGroups;
|
||||
private int $randomOrderSeed;
|
||||
private bool $includeUncoveredFiles;
|
||||
private TestSuiteCollection $testSuite;
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ final class Help
|
||||
private const LEFT_MARGIN = ' ';
|
||||
private int $lengthOfLongestOptionName = 0;
|
||||
private readonly int $columnsAvailableForDescription;
|
||||
private ?bool $hasColor;
|
||||
private bool $hasColor;
|
||||
|
||||
public function __construct(?int $width = null, ?bool $withColor = null)
|
||||
{
|
||||
|
||||
+4
-2
@@ -141,7 +141,8 @@ final class ProgressPrinter
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->source->ignoreSelfDeprecations() && $event->trigger()->isSelf()) {
|
||||
if ($this->source->ignoreSelfDeprecations() &&
|
||||
($event->trigger()->isTest() || $event->trigger()->isSelf())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,7 +172,8 @@ final class ProgressPrinter
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->source->ignoreSelfDeprecations() && $event->trigger()->isSelf()) {
|
||||
if ($this->source->ignoreSelfDeprecations() &&
|
||||
($event->trigger()->isTest() || $event->trigger()->isSelf())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -389,24 +389,28 @@ final class ResultPrinter
|
||||
$issue->line(),
|
||||
);
|
||||
|
||||
$body = trim($issue->description()) . PHP_EOL . PHP_EOL . 'Triggered by:';
|
||||
$body = trim($issue->description()) . PHP_EOL . PHP_EOL;
|
||||
|
||||
$triggeringTests = $issue->triggeringTests();
|
||||
if (!$issue->triggeredInTest()) {
|
||||
$body .= 'Triggered by:';
|
||||
|
||||
ksort($triggeringTests);
|
||||
$triggeringTests = $issue->triggeringTests();
|
||||
|
||||
foreach ($triggeringTests as $triggeringTest) {
|
||||
$body .= PHP_EOL . PHP_EOL . '* ' . $triggeringTest['test']->id();
|
||||
ksort($triggeringTests);
|
||||
|
||||
if ($triggeringTest['count'] > 1) {
|
||||
$body .= sprintf(
|
||||
' (%d times)',
|
||||
$triggeringTest['count'],
|
||||
);
|
||||
}
|
||||
foreach ($triggeringTests as $triggeringTest) {
|
||||
$body .= PHP_EOL . PHP_EOL . '* ' . $triggeringTest['test']->id();
|
||||
|
||||
if ($triggeringTest['test']->isTestMethod()) {
|
||||
$body .= PHP_EOL . ' ' . $triggeringTest['test']->file() . ':' . $triggeringTest['test']->line();
|
||||
if ($triggeringTest['count'] > 1) {
|
||||
$body .= sprintf(
|
||||
' (%d times)',
|
||||
$triggeringTest['count'],
|
||||
);
|
||||
}
|
||||
|
||||
if ($triggeringTest['test']->isTestMethod()) {
|
||||
$body .= PHP_EOL . ' ' . $triggeringTest['test']->file() . ':' . $triggeringTest['test']->line();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ use function sys_get_temp_dir;
|
||||
use function tempnam;
|
||||
use function trim;
|
||||
use function unlink;
|
||||
use function xdebug_is_debugger_active;
|
||||
use PHPUnit\Runner\CodeCoverage;
|
||||
use SebastianBergmann\Environment\Runtime;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user