diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1160b43cd48..fe6785bed11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: name: CI env: - COMPOSER_ROOT_VERSION: "10.5-dev" + COMPOSER_ROOT_VERSION: "11.0-dev" permissions: contents: read @@ -76,7 +76,6 @@ jobs: - windows-latest php-version: - - "8.1" - "8.2" - "8.3" - "8.4" @@ -123,7 +122,6 @@ jobs: - windows-latest php-version: - - "8.1" - "8.2" - "8.3" - "8.4" @@ -243,7 +241,6 @@ jobs: fail-fast: false matrix: php-version: - - "8.1" - "8.2" - "8.3" - "8.4" diff --git a/.phive/phars.xml b/.phive/phars.xml index c61da208aaa..de3c07c81ac 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,8 +1,8 @@ - + - + diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 7faf97e784d..c5b0ed90d0b 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -29,19 +29,15 @@ 'backtick_to_shell_exec' => true, 'binary_operator_spaces' => [ 'operators' => [ - '=' => 'align_single_space_minimal', + '*=' => 'align_single_space_minimal', '+=' => 'align_single_space_minimal', '-=' => 'align_single_space_minimal', - '*=' => 'align_single_space_minimal', '/=' => 'align_single_space_minimal', + '=' => 'align_single_space_minimal', '=>' => 'align_single_space_minimal', ], ], 'blank_line_after_namespace' => true, - 'blank_lines_before_namespace' => [ - 'max_line_breaks' => 1, - 'min_line_breaks' => 0, - ], 'blank_line_before_statement' => [ 'statements' => [ 'break', @@ -69,6 +65,14 @@ 'yield_from', ], ], + 'blank_lines_before_namespace' => [ + 'max_line_breaks' => 1, + 'min_line_breaks' => 0, + ], + 'braces_position' => [ + 'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end', + 'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end', + ], 'cast_spaces' => true, 'class_attributes_separation' => [ 'elements' => [ @@ -82,15 +86,11 @@ 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, 'combine_nested_dirname' => true, - 'compact_nullable_typehint' => true, + 'compact_nullable_type_declaration' => true, 'concat_space' => ['spacing' => 'one'], 'constant_case' => true, 'control_structure_braces' => true, 'control_structure_continuation_position' => true, - 'curly_braces_position' => [ - 'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end', - 'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end', - ], 'declare_equal_normalize' => ['space' => 'none'], 'declare_parentheses' => true, 'declare_strict_types' => true, @@ -146,10 +146,10 @@ '@internal', ], ], - 'native_function_type_declaration_casing' => true, - 'new_with_braces' => [ - 'named_class' => false, + 'native_type_declaration_casing' => true, + 'new_with_parentheses' => [ 'anonymous_class' => false, + 'named_class' => false, ], 'no_alias_functions' => true, 'no_alias_language_construct_call' => true, @@ -184,8 +184,8 @@ 'no_trailing_whitespace' => true, 'no_trailing_whitespace_in_comment' => true, 'no_trailing_whitespace_in_string' => true, + 'no_unneeded_braces' => true, 'no_unneeded_control_parentheses' => true, - 'no_unneeded_curly_braces' => true, 'no_unneeded_final_method' => true, 'no_unneeded_import_alias' => true, 'no_unreachable_default_argument_value' => true, diff --git a/.psalm/baseline.xml b/.psalm/baseline.xml index c6711f5a8a7..a82dbe73bde 100644 --- a/.psalm/baseline.xml +++ b/.psalm/baseline.xml @@ -30,6 +30,9 @@ $message $message + + assert($test instanceof TestMethod) + toString toString @@ -123,9 +126,6 @@ - - $data - $data @@ -469,6 +469,9 @@ getCode()]]> + + (int) $matches[0][1] + @@ -502,16 +505,6 @@ assert($metadata instanceof RequiresSetting) - - - IgnoreClassForCodeCoverage - IgnoreFunctionForCodeCoverage - IgnoreMethodForCodeCoverage - new IgnoreClassForCodeCoverage(self::CLASS_LEVEL, $className) - new IgnoreFunctionForCodeCoverage(self::CLASS_LEVEL, $functionName) - new IgnoreMethodForCodeCoverage(self::CLASS_LEVEL, $className, $methodName) - - $metadata @@ -555,15 +548,10 @@ - $className - $className - $className - $className - $className - $className + $_className + $_className $function $function - $methodName $pieces[0] $pieces[0] $pieces[1] @@ -580,13 +568,6 @@ trim($tmp[1]) - - - IgnoreClassForCodeCoverage::class - IgnoreFunctionForCodeCoverage::class - IgnoreMethodForCodeCoverage::class - - =']]> @@ -763,10 +744,6 @@ - - hasCacheResultFile - hasCoverageCacheDirectory - bool string @@ -797,17 +774,6 @@ - - cacheDirectory - cacheResultFile - cacheResultFile - coverageCacheDirectory - coverageCacheDirectory - hasCacheDirectory - hasCacheResultFile - hasCacheResultFile - hasCoverageCacheDirectory - baseline detect @@ -888,11 +854,6 @@ $variables - - - hasCacheDirectory - - getAttribute('class')]]> @@ -945,11 +906,6 @@ removeChild - - - hasCacheResultFile - - diff --git a/ChangeLog-10.5.md b/ChangeLog-10.5.md deleted file mode 100644 index 34a131137ac..00000000000 --- a/ChangeLog-10.5.md +++ /dev/null @@ -1,7 +0,0 @@ -# Changes in PHPUnit 10.5 - -All notable changes of the PHPUnit 10.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. - -## [10.5.0] - 2023-12-08 - -[10.5.0]: https://github.com/sebastianbergmann/phpunit/compare/10.4...main diff --git a/ChangeLog-11.0.md b/ChangeLog-11.0.md new file mode 100644 index 00000000000..88bd2e7f1e5 --- /dev/null +++ b/ChangeLog-11.0.md @@ -0,0 +1,48 @@ +# Changes in PHPUnit 11.0 + +All notable changes of the PHPUnit 11.0 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. + +## [11.0.0] - 2024-02-02 + +### Changed + +* [#5213](https://github.com/sebastianbergmann/phpunit/issues/5213): Make `TestCase` methods `protected` that should have been `protected` all along +* [#5254](https://github.com/sebastianbergmann/phpunit/issues/5254): Make `TestCase` methods `final` that should have been `final` all along + +### Deprecated + +* [#4505](https://github.com/sebastianbergmann/phpunit/issues/4505): Support for metadata in doc-comments +* [#5214](https://github.com/sebastianbergmann/phpunit/issues/5214): `TestCase::iniSet()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5216](https://github.com/sebastianbergmann/phpunit/issues/5216): `TestCase::setLocale()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5240](https://github.com/sebastianbergmann/phpunit/issues/5240): `TestCase::createTestProxy()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5241](https://github.com/sebastianbergmann/phpunit/issues/5241): `TestCase::getMockForAbstractClass()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5242](https://github.com/sebastianbergmann/phpunit/issues/5242): `TestCase::getMockFromWsdl()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5243](https://github.com/sebastianbergmann/phpunit/issues/5243): `TestCase::getMockForTrait()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5244](https://github.com/sebastianbergmann/phpunit/issues/5244): `TestCase::getObjectForTrait()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5305](https://github.com/sebastianbergmann/phpunit/issues/5305): `MockBuilder::getMockForAbstractClass()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5306](https://github.com/sebastianbergmann/phpunit/issues/5306): `MockBuilder::getMockForTrait()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307): `MockBuilder::enableProxyingToOriginalMethods()`, `MockBuilder::disableProxyingToOriginalMethods()`, and `MockBuilder::setProxyTarget()` (these methods were already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5308](https://github.com/sebastianbergmann/phpunit/issues/5308): `MockBuilder::allowMockingUnknownTypes()` and `MockBuilder::disallowMockingUnknownTypes()` (these methods were already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5309](https://github.com/sebastianbergmann/phpunit/issues/5309): `MockBuilder::enableAutoload()` and `MockBuilder::disableAutoload()` (these methods were already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5315](https://github.com/sebastianbergmann/phpunit/issues/5315): `MockBuilder::enableArgumentCloning()` and `MockBuilder::disableArgumentCloning()` (these methods were already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5320](https://github.com/sebastianbergmann/phpunit/issues/5320): `MockBuilder::addMethods()` (this method was already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5415](https://github.com/sebastianbergmann/phpunit/issues/5415): Support for doubling interfaces (or classes) that have a method named `method` +* [#5421](https://github.com/sebastianbergmann/phpunit/issues/5421): `MockBuilder::enableAutoReturnValueGeneration()` and `MockBuilder::disableAutoReturnValueGeneration()` (these methods were already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423): `TestCase::returnValue()`, `TestCase::onConsecutiveCalls()`, `TestCase::returnValueMap()`, `TestCase::returnArgument()`, `TestCase::returnSelf()`, and `TestCase::returnCallback()` (these methods were already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472): `assertStringNotMatchesFormat()` and `assertStringNotMatchesFormatFile()` (these methods were already [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation) in PHPUnit 10) +* [#5535](https://github.com/sebastianbergmann/phpunit/issues/5535): Configuring expectations using `expects()` on test stubs + +### Removed + +* [#4600](https://github.com/sebastianbergmann/phpunit/issues/4600): Support for old cache configuration +* [#4604](https://github.com/sebastianbergmann/phpunit/issues/4604): Support for `backupStaticAttributes` attribute in XML configuration file +* [#4779](https://github.com/sebastianbergmann/phpunit/issues/4779): Support for `forceCoversAnnotation` and `beStrictAboutCoversAnnotation` attributes in XML configuration file +* [#5100](https://github.com/sebastianbergmann/phpunit/issues/5100): Support for non-static data provider methods, non-public data provider methods, and data provider methods that declare parameters +* [#5101](https://github.com/sebastianbergmann/phpunit/issues/5101): Support for PHP 8.1 +* [#5272](https://github.com/sebastianbergmann/phpunit/issues/5272): Optional parameters of `PHPUnit\Framework\Constraint\IsEqual::__construct()` +* [#5329](https://github.com/sebastianbergmann/phpunit/issues/5329): Support for configuring include/exclude list for code coverage using the `` element +* [#5482](https://github.com/sebastianbergmann/phpunit/issues/5482): `dataSet` attribute for `testCaseMethod` elements in the XML document generated by `--list-tests-xml` +* [#5514](https://github.com/sebastianbergmann/phpunit/issues/5514:) `IgnoreClassForCodeCoverage`, `IgnoreMethodForCodeCoverage`, and `IgnoreFunctionForCodeCoverage` attributes +* `CodeCoverageIgnore` attribute + +[11.0.0]: https://github.com/sebastianbergmann/phpunit/compare/10.5...main diff --git a/DEPRECATIONS.md b/DEPRECATIONS.md index 56c773698cf..4c2323ca3a1 100644 --- a/DEPRECATIONS.md +++ b/DEPRECATIONS.md @@ -4,62 +4,6 @@ This functionality is currently [soft-deprecated](https://phpunit.de/backward-compatibility.html#soft-deprecation): -### Writing Tests - -#### Assertions, Constraints, and Expectations - -| Issue | Description | Since | Replacement | -|-------------------------------------------------------------------|------------------------------------------------|--------|-------------| -| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `TestCase::assertStringNotMatchesFormat()` | 10.4.0 | | -| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `TestCase::assertStringNotMatchesFormatFile()` | 10.4.0 | | - -#### Test Double API - -| Issue | Description | Since | Replacement | -|-------------------------------------------------------------------|---------------------------------------------------|--------|-----------------------------------------------------------------------------------------| -| [#5240](https://github.com/sebastianbergmann/phpunit/issues/5240) | `TestCase::createTestProxy()` | 10.1.0 | | -| [#5241](https://github.com/sebastianbergmann/phpunit/issues/5241) | `TestCase::getMockForAbstractClass()` | 10.1.0 | | -| [#5242](https://github.com/sebastianbergmann/phpunit/issues/5242) | `TestCase::getMockFromWsdl()` | 10.1.0 | | -| [#5243](https://github.com/sebastianbergmann/phpunit/issues/5243) | `TestCase::getMockForTrait()` | 10.1.0 | | -| [#5244](https://github.com/sebastianbergmann/phpunit/issues/5244) | `TestCase::getObjectForTrait()` | 10.1.0 | | -| [#5305](https://github.com/sebastianbergmann/phpunit/issues/5305) | `MockBuilder::getMockForAbstractClass()` | 10.1.0 | | -| [#5306](https://github.com/sebastianbergmann/phpunit/issues/5306) | `MockBuilder::getMockForTrait()` | 10.1.0 | | -| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::disableProxyingToOriginalMethods()` | 10.1.0 | | -| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::enableProxyingToOriginalMethods()` | 10.1.0 | | -| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::setProxyTarget()` | 10.1.0 | | -| [#5308](https://github.com/sebastianbergmann/phpunit/issues/5308) | `MockBuilder::allowMockingUnknownTypes()` | 10.1.0 | | -| [#5308](https://github.com/sebastianbergmann/phpunit/issues/5308) | `MockBuilder::disallowMockingUnknownTypes()` | 10.1.0 | | -| [#5309](https://github.com/sebastianbergmann/phpunit/issues/5309) | `MockBuilder::disableAutoload()` | 10.1.0 | | -| [#5309](https://github.com/sebastianbergmann/phpunit/issues/5309) | `MockBuilder::enableAutoload()` | 10.1.0 | | -| [#5315](https://github.com/sebastianbergmann/phpunit/issues/5315) | `MockBuilder::disableArgumentCloning()` | 10.1.0 | | -| [#5315](https://github.com/sebastianbergmann/phpunit/issues/5315) | `MockBuilder::enableArgumentCloning()` | 10.1.0 | | -| [#5320](https://github.com/sebastianbergmann/phpunit/issues/5320) | `MockBuilder::addMethods()` | 10.1.0 | | -| [#5421](https://github.com/sebastianbergmann/phpunit/issues/5421) | `MockBuilder::disableAutoReturnValueGeneration()` | 10.3.0 | | -| [#5421](https://github.com/sebastianbergmann/phpunit/issues/5421) | `MockBuilder::enableAutoReturnValueGeneration()` | 10.3.0 | | -| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::onConsecutiveCalls()` | 10.3.0 | Use `$double->willReturn()` instead of `$double->will($this->onConsecutiveCalls())` | -| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnArgument()` | 10.3.0 | Use `$double->willReturnArgument()` instead of `$double->will($this->returnArgument())` | -| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnCallback()` | 10.3.0 | Use `$double->willReturnCallback()` instead of `$double->will($this->returnCallback())` | -| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnSelf()` | 10.3.0 | Use `$double->willReturnSelf()` instead of `$double->will($this->returnSelf())` | -| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnValue()` | 10.3.0 | Use `$double->willReturn()` instead of `$double->will($this->returnValue())` | -| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnValueMap()` | 10.3.0 | Use `$double->willReturnMap()` instead of `$double->will($this->returnValueMap())` | - -#### Miscellaneous - -| Issue | Description | Since | Replacement | -|-------------------------------------------------------------------|----------------------------------------------------------------|--------|--------------------------------------------------------------------| -| [#5236](https://github.com/sebastianbergmann/phpunit/issues/5236) | `PHPUnit\Framework\Attributes\CodeCoverageIgnore()` | 10.1.0 | | -| [#5214](https://github.com/sebastianbergmann/phpunit/issues/5214) | `TestCase::iniSet()` | 10.3.0 | | -| [#5216](https://github.com/sebastianbergmann/phpunit/issues/5216) | `TestCase::setLocale()` | 10.3.0 | | -| [#5236](https://github.com/sebastianbergmann/phpunit/issues/5513) | `PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage()` | 10.4.0 | Use `@codeCoverageIgnore` annotation in the class' doc-comment | -| [#5236](https://github.com/sebastianbergmann/phpunit/issues/5513) | `PHPUnit\Framework\Attributes\IgnoreMethodForCodeCoverage()` | 10.4.0 | Use `@codeCoverageIgnore` annotation in the method's doc-comment | -| [#5236](https://github.com/sebastianbergmann/phpunit/issues/5513) | `PHPUnit\Framework\Attributes\IgnoreFunctionForCodeCoverage()` | 10.4.0 | Use `@codeCoverageIgnore` annotation in the function's doc-comment | - -### Running Tests - -| Issue | Description | Since | Replacement | -|-------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|--------|-------------| -| [#5481](https://github.com/sebastianbergmann/phpunit/issues/5481) | `dataSet` attribute for `testCaseMethod` elements in the XML document generated by `--list-tests-xml` | 10.4.0 | | - ### Extending PHPUnit | Issue | Description | Since | Replacement | @@ -83,8 +27,49 @@ This functionality is currently [hard-deprecated](https://phpunit.de/backward-co ### Writing Tests +#### Assertions, Constraints, and Expectations + +| Issue | Description | Since | Replacement | +|-------------------------------------------------------------------|------------------------------------------------|--------|-------------| +| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `TestCase::assertStringNotMatchesFormat()` | 10.4.0 | | +| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `TestCase::assertStringNotMatchesFormatFile()` | 10.4.0 | | + +#### Test Double API + +| Issue | Description | Since | Replacement | +|-------------------------------------------------------------------|--------------------------------------------------------------------------------|--------|-----------------------------------------------------------------------------------------| +| [#5240](https://github.com/sebastianbergmann/phpunit/issues/5240) | `TestCase::createTestProxy()` | 10.1.0 | | +| [#5241](https://github.com/sebastianbergmann/phpunit/issues/5241) | `TestCase::getMockForAbstractClass()` | 10.1.0 | | +| [#5242](https://github.com/sebastianbergmann/phpunit/issues/5242) | `TestCase::getMockFromWsdl()` | 10.1.0 | | +| [#5243](https://github.com/sebastianbergmann/phpunit/issues/5243) | `TestCase::getMockForTrait()` | 10.1.0 | | +| [#5244](https://github.com/sebastianbergmann/phpunit/issues/5244) | `TestCase::getObjectForTrait()` | 10.1.0 | | +| [#5305](https://github.com/sebastianbergmann/phpunit/issues/5305) | `MockBuilder::getMockForAbstractClass()` | 10.1.0 | | +| [#5306](https://github.com/sebastianbergmann/phpunit/issues/5306) | `MockBuilder::getMockForTrait()` | 10.1.0 | | +| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::disableProxyingToOriginalMethods()` | 10.1.0 | | +| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::enableProxyingToOriginalMethods()` | 10.1.0 | | +| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::setProxyTarget()` | 10.1.0 | | +| [#5308](https://github.com/sebastianbergmann/phpunit/issues/5308) | `MockBuilder::allowMockingUnknownTypes()` | 10.1.0 | | +| [#5308](https://github.com/sebastianbergmann/phpunit/issues/5308) | `MockBuilder::disallowMockingUnknownTypes()` | 10.1.0 | | +| [#5309](https://github.com/sebastianbergmann/phpunit/issues/5309) | `MockBuilder::disableAutoload()` | 10.1.0 | | +| [#5309](https://github.com/sebastianbergmann/phpunit/issues/5309) | `MockBuilder::enableAutoload()` | 10.1.0 | | +| [#5315](https://github.com/sebastianbergmann/phpunit/issues/5315) | `MockBuilder::disableArgumentCloning()` | 10.1.0 | | +| [#5315](https://github.com/sebastianbergmann/phpunit/issues/5315) | `MockBuilder::enableArgumentCloning()` | 10.1.0 | | +| [#5320](https://github.com/sebastianbergmann/phpunit/issues/5320) | `MockBuilder::addMethods()` | 10.1.0 | | +| [#5415](https://github.com/sebastianbergmann/phpunit/issues/5415) | Support for doubling interfaces (or classes) that have a method named `method` | 11.0.0 | | +| [#5421](https://github.com/sebastianbergmann/phpunit/issues/5421) | `MockBuilder::disableAutoReturnValueGeneration()` | 10.3.0 | | +| [#5421](https://github.com/sebastianbergmann/phpunit/issues/5421) | `MockBuilder::enableAutoReturnValueGeneration()` | 10.3.0 | | +| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::onConsecutiveCalls()` | 10.3.0 | Use `$double->willReturn()` instead of `$double->will($this->onConsecutiveCalls())` | +| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnArgument()` | 10.3.0 | Use `$double->willReturnArgument()` instead of `$double->will($this->returnArgument())` | +| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnCallback()` | 10.3.0 | Use `$double->willReturnCallback()` instead of `$double->will($this->returnCallback())` | +| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnSelf()` | 10.3.0 | Use `$double->willReturnSelf()` instead of `$double->will($this->returnSelf())` | +| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnValue()` | 10.3.0 | Use `$double->willReturn()` instead of `$double->will($this->returnValue())` | +| [#5423](https://github.com/sebastianbergmann/phpunit/issues/5423) | `TestCase::returnValueMap()` | 10.3.0 | Use `$double->willReturnMap()` instead of `$double->will($this->returnValueMap())` | +| [#5535](https://github.com/sebastianbergmann/phpunit/issues/5525) | Configuring expectations using `expects()` on test stubs | 11.0.0 | Create a mock object when you need to configure expectations on a test double | + #### Miscellaneous -| Issue | Description | Since | Replacement | -|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|--------|-------------| -| [#5100](https://github.com/sebastianbergmann/phpunit/issues/5100) | Support for non-static data provider methods, non-public data provider methods, and data provider methods that declare parameters | 10.0.0 | | +| Issue | Description | Since | Replacement | +|-------------------------------------------------------------------|--------------------------|--------|------------------------| +| [#4505](https://github.com/sebastianbergmann/phpunit/issues/4505) | Metadata in doc-comments | 10.3.0 | Metadata in attributes | +| [#5214](https://github.com/sebastianbergmann/phpunit/issues/5214) | `TestCase::iniSet()` | 10.3.0 | | +| [#5216](https://github.com/sebastianbergmann/phpunit/issues/5216) | `TestCase::setLocale()` | 10.3.0 | | diff --git a/build/templates/binary-phar-autoload.php.in b/build/templates/binary-phar-autoload.php.in index b18bc73a491..4dfcbb20b5d 100644 --- a/build/templates/binary-phar-autoload.php.in +++ b/build/templates/binary-phar-autoload.php.in @@ -15,12 +15,12 @@ if (!version_compare(PHP_VERSION, PHP_VERSION, '=')) { die(1); } -if (version_compare('8.1.0', PHP_VERSION, '>')) { +if (version_compare('8.2.0', PHP_VERSION, '>')) { fwrite( STDERR, sprintf( 'PHPUnit X.Y.Z by Sebastian Bergmann and contributors.' . PHP_EOL . PHP_EOL . - 'This version of PHPUnit requires PHP >= 8.1.' . PHP_EOL . + 'This version of PHPUnit requires PHP >= 8.2.' . PHP_EOL . 'You are using PHP %s (%s).' . PHP_EOL, PHP_VERSION, PHP_BINARY diff --git a/build/test-extension/manifest.xml b/build/test-extension/manifest.xml index 9cc43aa598a..c9f4caf1c03 100644 --- a/build/test-extension/manifest.xml +++ b/build/test-extension/manifest.xml @@ -1,7 +1,7 @@ - + diff --git a/composer.json b/composer.json index 4f81fae0380..5cb0b9ba550 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "prefer-stable": true, "require": { - "php": ">=8.1", + "php": ">=8.2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -51,7 +51,7 @@ }, "config": { "platform": { - "php": "8.1.0" + "php": "8.2.0" }, "optimize-autoloader": true, "sort-packages": true @@ -78,13 +78,12 @@ "tests/_files/CoverageNamespacedFunctionTest.php", "tests/_files/CoveredFunction.php", "tests/_files/Generator.php", - "tests/_files/NamespaceCoveredFunction.php", - "tests/end-to-end/code-coverage/ignore-function-using-attribute/src/CoveredFunction.php" + "tests/_files/NamespaceCoveredFunction.php" ] }, "extra": { "branch-alias": { - "dev-main": "10.5-dev" + "dev-main": "11.0-dev" } } } diff --git a/phpunit b/phpunit index 624c8b4d7b0..860a1910329 100755 --- a/phpunit +++ b/phpunit @@ -24,11 +24,11 @@ if (!version_compare(PHP_VERSION, PHP_VERSION, '=')) { die(1); } -if (version_compare('8.1.0', PHP_VERSION, '>')) { +if (version_compare('8.2.0', PHP_VERSION, '>')) { fwrite( STDERR, sprintf( - 'This version of PHPUnit requires PHP >= 8.1.' . PHP_EOL . + 'This version of PHPUnit requires PHP >= 8.2.' . PHP_EOL . 'You are using PHP %s (%s).' . PHP_EOL, PHP_VERSION, PHP_BINARY diff --git a/phpunit.xml b/phpunit.xml index f4f103eb2d3..cabc86fa32b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -15,7 +15,6 @@ tests/end-to-end/baseline tests/end-to-end/cli - tests/end-to-end/code-coverage tests/end-to-end/event tests/end-to-end/execution-order tests/end-to-end/extension diff --git a/phpunit.xsd b/phpunit.xsd index 42a844890e6..aa8721eb5d5 100644 --- a/phpunit.xsd +++ b/phpunit.xsd @@ -2,7 +2,7 @@ - This Schema file defines the rules by which the XML configuration file of PHPUnit 10.5 may be structured. + This Schema file defines the rules by which the XML configuration file of PHPUnit 11.0 may be structured. diff --git a/src/Event/Emitter/DispatchingEmitter.php b/src/Event/Emitter/DispatchingEmitter.php index 857a870c52f..d47538b5b5e 100644 --- a/src/Event/Emitter/DispatchingEmitter.php +++ b/src/Event/Emitter/DispatchingEmitter.php @@ -9,8 +9,12 @@ */ namespace PHPUnit\Event; +use function assert; use PHPUnit\Event\Code\ClassMethod; use PHPUnit\Event\Code\ComparisonFailure; +use PHPUnit\Event\Code\NoTestCaseObjectOnCallStackException; +use PHPUnit\Event\Code\TestMethod; +use PHPUnit\Event\Code\TestMethodBuilder; use PHPUnit\Event\Code\Throwable; use PHPUnit\Event\Test\DataProviderMethodCalled; use PHPUnit\Event\Test\DataProviderMethodFinished; @@ -752,10 +756,23 @@ public function testSkipped(Code\Test $test, string $message): void /** * @throws InvalidArgumentException + * @throws NoTestCaseObjectOnCallStackException * @throws UnknownEventTypeException */ - public function testTriggeredPhpunitDeprecation(Code\Test $test, string $message): void + public function testTriggeredPhpunitDeprecation(?Code\Test $test, string $message): void { + if ($test === null) { + $test = TestMethodBuilder::fromCallStack(); + } + + if ($test->isTestMethod()) { + assert($test instanceof TestMethod); + + if ($test->metadata()->isIgnorePhpunitDeprecations()->isNotEmpty()) { + return; + } + } + $this->dispatcher->dispatch( new Test\PhpunitDeprecationTriggered( $this->telemetryInfo(), @@ -769,7 +786,7 @@ public function testTriggeredPhpunitDeprecation(Code\Test $test, string $message * @throws InvalidArgumentException * @throws UnknownEventTypeException */ - public function testTriggeredPhpDeprecation(Code\Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline): void + public function testTriggeredPhpDeprecation(Code\Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline, bool $ignoredByTest): void { $this->dispatcher->dispatch( new Test\PhpDeprecationTriggered( @@ -780,6 +797,7 @@ public function testTriggeredPhpDeprecation(Code\Test $test, string $message, st $line, $suppressed, $ignoredByBaseline, + $ignoredByTest, ), ); } @@ -788,7 +806,7 @@ public function testTriggeredPhpDeprecation(Code\Test $test, string $message, st * @throws InvalidArgumentException * @throws UnknownEventTypeException */ - public function testTriggeredDeprecation(Code\Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline): void + public function testTriggeredDeprecation(Code\Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline, bool $ignoredByTest): void { $this->dispatcher->dispatch( new Test\DeprecationTriggered( @@ -799,6 +817,7 @@ public function testTriggeredDeprecation(Code\Test $test, string $message, strin $line, $suppressed, $ignoredByBaseline, + $ignoredByTest, ), ); } diff --git a/src/Event/Emitter/Emitter.php b/src/Event/Emitter/Emitter.php index e9fb74e9e03..65752daec7a 100644 --- a/src/Event/Emitter/Emitter.php +++ b/src/Event/Emitter/Emitter.php @@ -171,11 +171,11 @@ public function testMarkedAsIncomplete(Code\Test $test, Throwable $throwable): v public function testSkipped(Code\Test $test, string $message): void; - public function testTriggeredPhpunitDeprecation(Code\Test $test, string $message): void; + public function testTriggeredPhpunitDeprecation(?Code\Test $test, string $message): void; - public function testTriggeredPhpDeprecation(Code\Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline): void; + public function testTriggeredPhpDeprecation(Code\Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline, bool $ignoredByTest): void; - public function testTriggeredDeprecation(Code\Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline): void; + public function testTriggeredDeprecation(Code\Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline, bool $ignoredByTest): void; public function testTriggeredError(Code\Test $test, string $message, string $file, int $line, bool $suppressed): void; diff --git a/src/Event/Events/Application/Finished.php b/src/Event/Events/Application/Finished.php index e196c4f6f1d..1f1791b0910 100644 --- a/src/Event/Events/Application/Finished.php +++ b/src/Event/Events/Application/Finished.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Finished implements Event +final readonly class Finished implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly int $shellExitCode; + private Telemetry\Info $telemetryInfo; + private int $shellExitCode; public function __construct(Telemetry\Info $telemetryInfo, int $shellExitCode) { diff --git a/src/Event/Events/Application/Started.php b/src/Event/Events/Application/Started.php index da570a0277b..21124322364 100644 --- a/src/Event/Events/Application/Started.php +++ b/src/Event/Events/Application/Started.php @@ -19,10 +19,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Started implements Event +final readonly class Started implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Runtime $runtime; + private Telemetry\Info $telemetryInfo; + private Runtime $runtime; public function __construct(Telemetry\Info $telemetryInfo, Runtime $runtime) { diff --git a/src/Event/Events/Test/Assertion/AssertionFailed.php b/src/Event/Events/Test/Assertion/AssertionFailed.php index cab77823715..acc023565e5 100644 --- a/src/Event/Events/Test/Assertion/AssertionFailed.php +++ b/src/Event/Events/Test/Assertion/AssertionFailed.php @@ -16,13 +16,13 @@ /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class AssertionFailed implements Event +final readonly class AssertionFailed implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly string $value; - private readonly string $constraint; - private readonly int $count; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private string $value; + private string $constraint; + private int $count; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, string $value, string $constraint, int $count, string $message) { diff --git a/src/Event/Events/Test/Assertion/AssertionSucceeded.php b/src/Event/Events/Test/Assertion/AssertionSucceeded.php index 405753e8ec8..5163b298396 100644 --- a/src/Event/Events/Test/Assertion/AssertionSucceeded.php +++ b/src/Event/Events/Test/Assertion/AssertionSucceeded.php @@ -16,13 +16,13 @@ /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class AssertionSucceeded implements Event +final readonly class AssertionSucceeded implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly string $value; - private readonly string $constraint; - private readonly int $count; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private string $value; + private string $constraint; + private int $count; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, string $value, string $constraint, int $count, string $message) { diff --git a/src/Event/Events/Test/ComparatorRegistered.php b/src/Event/Events/Test/ComparatorRegistered.php index 9e83d3d21fd..dfbb5909fe9 100644 --- a/src/Event/Events/Test/ComparatorRegistered.php +++ b/src/Event/Events/Test/ComparatorRegistered.php @@ -18,14 +18,14 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ComparatorRegistered implements Event +final readonly class ComparatorRegistered implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Event/Events/Test/HookMethod/AfterLastTestMethodCalled.php b/src/Event/Events/Test/HookMethod/AfterLastTestMethodCalled.php index fec2a79e546..9924ffb9af3 100644 --- a/src/Event/Events/Test/HookMethod/AfterLastTestMethodCalled.php +++ b/src/Event/Events/Test/HookMethod/AfterLastTestMethodCalled.php @@ -19,15 +19,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class AfterLastTestMethodCalled implements Event +final readonly class AfterLastTestMethodCalled implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; - private readonly Code\ClassMethod $calledMethod; + private string $testClassName; + private Code\ClassMethod $calledMethod; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/AfterLastTestMethodFinished.php b/src/Event/Events/Test/HookMethod/AfterLastTestMethodFinished.php index 40a6c9fcc56..1ba74612bcf 100644 --- a/src/Event/Events/Test/HookMethod/AfterLastTestMethodFinished.php +++ b/src/Event/Events/Test/HookMethod/AfterLastTestMethodFinished.php @@ -20,19 +20,19 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class AfterLastTestMethodFinished implements Event +final readonly class AfterLastTestMethodFinished implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; + private string $testClassName; /** * @psalm-var list */ - private readonly array $calledMethods; + private array $calledMethods; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/AfterTestMethodCalled.php b/src/Event/Events/Test/HookMethod/AfterTestMethodCalled.php index 52afc14c80a..d096b965857 100644 --- a/src/Event/Events/Test/HookMethod/AfterTestMethodCalled.php +++ b/src/Event/Events/Test/HookMethod/AfterTestMethodCalled.php @@ -19,15 +19,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class AfterTestMethodCalled implements Event +final readonly class AfterTestMethodCalled implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; - private readonly Code\ClassMethod $calledMethod; + private string $testClassName; + private Code\ClassMethod $calledMethod; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/AfterTestMethodFinished.php b/src/Event/Events/Test/HookMethod/AfterTestMethodFinished.php index e934eea84d9..5431d5f94d3 100644 --- a/src/Event/Events/Test/HookMethod/AfterTestMethodFinished.php +++ b/src/Event/Events/Test/HookMethod/AfterTestMethodFinished.php @@ -20,19 +20,19 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class AfterTestMethodFinished implements Event +final readonly class AfterTestMethodFinished implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; + private string $testClassName; /** * @psalm-var list */ - private readonly array $calledMethods; + private array $calledMethods; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalled.php b/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalled.php index da28f2bf291..58381ec2448 100644 --- a/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalled.php +++ b/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalled.php @@ -19,15 +19,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class BeforeFirstTestMethodCalled implements Event +final readonly class BeforeFirstTestMethodCalled implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; - private readonly Code\ClassMethod $calledMethod; + private string $testClassName; + private Code\ClassMethod $calledMethod; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodErrored.php b/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodErrored.php index 81833227a23..afe1002f021 100644 --- a/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodErrored.php +++ b/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodErrored.php @@ -20,16 +20,16 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class BeforeFirstTestMethodErrored implements Event +final readonly class BeforeFirstTestMethodErrored implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; - private readonly Code\ClassMethod $calledMethod; - private readonly Throwable $throwable; + private string $testClassName; + private Code\ClassMethod $calledMethod; + private Throwable $throwable; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodFinished.php b/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodFinished.php index fba563d7123..b23857feb25 100644 --- a/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodFinished.php +++ b/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodFinished.php @@ -20,19 +20,19 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class BeforeFirstTestMethodFinished implements Event +final readonly class BeforeFirstTestMethodFinished implements Event { - private readonly Telemetry\Info$telemetryInfo; + private Telemetry\Info$telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; + private string $testClassName; /** * @psalm-var list */ - private readonly array $calledMethods; + private array $calledMethods; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/BeforeTestMethodCalled.php b/src/Event/Events/Test/HookMethod/BeforeTestMethodCalled.php index 3b300fa305f..f3b9846a636 100644 --- a/src/Event/Events/Test/HookMethod/BeforeTestMethodCalled.php +++ b/src/Event/Events/Test/HookMethod/BeforeTestMethodCalled.php @@ -19,15 +19,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class BeforeTestMethodCalled implements Event +final readonly class BeforeTestMethodCalled implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; - private readonly Code\ClassMethod $calledMethod; + private string $testClassName; + private Code\ClassMethod $calledMethod; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/BeforeTestMethodFinished.php b/src/Event/Events/Test/HookMethod/BeforeTestMethodFinished.php index f84b51bb0ad..034abd817ab 100644 --- a/src/Event/Events/Test/HookMethod/BeforeTestMethodFinished.php +++ b/src/Event/Events/Test/HookMethod/BeforeTestMethodFinished.php @@ -20,19 +20,19 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class BeforeTestMethodFinished implements Event +final readonly class BeforeTestMethodFinished implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; + private string $testClassName; /** * @psalm-var list */ - private readonly array $calledMethods; + private array $calledMethods; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/PostConditionCalled.php b/src/Event/Events/Test/HookMethod/PostConditionCalled.php index e7b6c435b35..ac7a1e3f1c1 100644 --- a/src/Event/Events/Test/HookMethod/PostConditionCalled.php +++ b/src/Event/Events/Test/HookMethod/PostConditionCalled.php @@ -19,15 +19,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PostConditionCalled implements Event +final readonly class PostConditionCalled implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; - private readonly Code\ClassMethod $calledMethod; + private string $testClassName; + private Code\ClassMethod $calledMethod; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/PostConditionFinished.php b/src/Event/Events/Test/HookMethod/PostConditionFinished.php index fff07ce7bfd..52d9676e81e 100644 --- a/src/Event/Events/Test/HookMethod/PostConditionFinished.php +++ b/src/Event/Events/Test/HookMethod/PostConditionFinished.php @@ -20,19 +20,19 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PostConditionFinished implements Event +final readonly class PostConditionFinished implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; + private string $testClassName; /** * @psalm-var list */ - private readonly array $calledMethods; + private array $calledMethods; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/PreConditionCalled.php b/src/Event/Events/Test/HookMethod/PreConditionCalled.php index 93752546a6f..41ab3855f78 100644 --- a/src/Event/Events/Test/HookMethod/PreConditionCalled.php +++ b/src/Event/Events/Test/HookMethod/PreConditionCalled.php @@ -19,15 +19,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PreConditionCalled implements Event +final readonly class PreConditionCalled implements Event { - private readonly Telemetry\Info$telemetryInfo; + private Telemetry\Info$telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; - private readonly Code\ClassMethod $calledMethod; + private string $testClassName; + private Code\ClassMethod $calledMethod; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/HookMethod/PreConditionFinished.php b/src/Event/Events/Test/HookMethod/PreConditionFinished.php index 05340796c61..f6e3ac80e05 100644 --- a/src/Event/Events/Test/HookMethod/PreConditionFinished.php +++ b/src/Event/Events/Test/HookMethod/PreConditionFinished.php @@ -20,19 +20,19 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PreConditionFinished implements Event +final readonly class PreConditionFinished implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $testClassName; + private string $testClassName; /** * @psalm-var list */ - private readonly array $calledMethods; + private array $calledMethods; /** * @psalm-param class-string $testClassName diff --git a/src/Event/Events/Test/Issue/ConsideredRisky.php b/src/Event/Events/Test/Issue/ConsideredRisky.php index 5b90d1bf904..742efede266 100644 --- a/src/Event/Events/Test/Issue/ConsideredRisky.php +++ b/src/Event/Events/Test/Issue/ConsideredRisky.php @@ -20,15 +20,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ConsideredRisky implements Event +final readonly class ConsideredRisky implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; /** * @psalm-var non-empty-string */ - private readonly string $message; + private string $message; /** * @psalm-param non-empty-string $message diff --git a/src/Event/Events/Test/Issue/DeprecationTriggered.php b/src/Event/Events/Test/Issue/DeprecationTriggered.php index 7eeb2340333..4d7c9792ac3 100644 --- a/src/Event/Events/Test/Issue/DeprecationTriggered.php +++ b/src/Event/Events/Test/Issue/DeprecationTriggered.php @@ -20,34 +20,35 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class DeprecationTriggered implements Event +final readonly class DeprecationTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; + private Telemetry\Info $telemetryInfo; + private Test $test; /** * @psalm-var non-empty-string */ - private readonly string $message; + private string $message; /** * @psalm-var non-empty-string */ - private readonly string $file; + private string $file; /** * @psalm-var positive-int */ - private readonly int $line; - private readonly bool $suppressed; - private readonly bool $ignoredByBaseline; + private int $line; + private bool $suppressed; + private bool $ignoredByBaseline; + private bool $ignoredByTest; /** * @psalm-param non-empty-string $message * @psalm-param non-empty-string $file * @psalm-param positive-int $line */ - public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline) + public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline, bool $ignoredByTest) { $this->telemetryInfo = $telemetryInfo; $this->test = $test; @@ -56,6 +57,7 @@ public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $m $this->line = $line; $this->suppressed = $suppressed; $this->ignoredByBaseline = $ignoredByBaseline; + $this->ignoredByTest = $ignoredByTest; } public function telemetryInfo(): Telemetry\Info @@ -102,6 +104,11 @@ public function ignoredByBaseline(): bool return $this->ignoredByBaseline; } + public function ignoredByTest(): bool + { + return $this->ignoredByTest; + } + public function asString(): string { $message = $this->message; @@ -112,7 +119,9 @@ public function asString(): string $status = ''; - if ($this->ignoredByBaseline) { + if ($this->ignoredByTest) { + $status = 'Test-Ignored '; + } elseif ($this->ignoredByBaseline) { $status = 'Baseline-Ignored '; } elseif ($this->suppressed) { $status = 'Suppressed '; diff --git a/src/Event/Events/Test/Issue/ErrorTriggered.php b/src/Event/Events/Test/Issue/ErrorTriggered.php index 0407c0b702c..f98cb0b4b82 100644 --- a/src/Event/Events/Test/Issue/ErrorTriggered.php +++ b/src/Event/Events/Test/Issue/ErrorTriggered.php @@ -20,26 +20,26 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ErrorTriggered implements Event +final readonly class ErrorTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; + private Telemetry\Info $telemetryInfo; + private Test $test; /** * @psalm-var non-empty-string */ - private readonly string $message; + private string $message; /** * @psalm-var non-empty-string */ - private readonly string $file; + private string $file; /** * @psalm-var positive-int */ - private readonly int $line; - private readonly bool $suppressed; + private int $line; + private bool $suppressed; /** * @psalm-param non-empty-string $message diff --git a/src/Event/Events/Test/Issue/NoticeTriggered.php b/src/Event/Events/Test/Issue/NoticeTriggered.php index d8a27bbd852..cf507ade038 100644 --- a/src/Event/Events/Test/Issue/NoticeTriggered.php +++ b/src/Event/Events/Test/Issue/NoticeTriggered.php @@ -20,27 +20,27 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class NoticeTriggered implements Event +final readonly class NoticeTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; + private Telemetry\Info $telemetryInfo; + private Test $test; /** * @psalm-var non-empty-string */ - private readonly string $message; + private string $message; /** * @psalm-var non-empty-string */ - private readonly string $file; + private string $file; /** * @psalm-var positive-int */ - private readonly int $line; - private readonly bool $suppressed; - private readonly bool $ignoredByBaseline; + private int $line; + private bool $suppressed; + private bool $ignoredByBaseline; /** * @psalm-param non-empty-string $message diff --git a/src/Event/Events/Test/Issue/PhpDeprecationTriggered.php b/src/Event/Events/Test/Issue/PhpDeprecationTriggered.php index a59e5c41cbb..f7205e55c9f 100644 --- a/src/Event/Events/Test/Issue/PhpDeprecationTriggered.php +++ b/src/Event/Events/Test/Issue/PhpDeprecationTriggered.php @@ -20,34 +20,35 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PhpDeprecationTriggered implements Event +final readonly class PhpDeprecationTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; + private Telemetry\Info $telemetryInfo; + private Test $test; /** * @psalm-var non-empty-string */ - private readonly string $message; + private string $message; /** * @psalm-var non-empty-string */ - private readonly string $file; + private string $file; /** * @psalm-var positive-int */ - private readonly int $line; - private readonly bool $suppressed; - private readonly bool $ignoredByBaseline; + private int $line; + private bool $suppressed; + private bool $ignoredByBaseline; + private bool $ignoredByTest; /** * @psalm-param non-empty-string $message * @psalm-param non-empty-string $file * @psalm-param positive-int $line */ - public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline) + public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $message, string $file, int $line, bool $suppressed, bool $ignoredByBaseline, bool $ignoredByTest) { $this->telemetryInfo = $telemetryInfo; $this->test = $test; @@ -56,6 +57,7 @@ public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $m $this->line = $line; $this->suppressed = $suppressed; $this->ignoredByBaseline = $ignoredByBaseline; + $this->ignoredByTest = $ignoredByTest; } public function telemetryInfo(): Telemetry\Info @@ -102,6 +104,11 @@ public function ignoredByBaseline(): bool return $this->ignoredByBaseline; } + public function ignoredByTest(): bool + { + return $this->ignoredByTest; + } + public function asString(): string { $message = $this->message; @@ -112,7 +119,9 @@ public function asString(): string $status = ''; - if ($this->ignoredByBaseline) { + if ($this->ignoredByTest) { + $status = 'Test-Ignored '; + } elseif ($this->ignoredByBaseline) { $status = 'Baseline-Ignored '; } elseif ($this->suppressed) { $status = 'Suppressed '; diff --git a/src/Event/Events/Test/Issue/PhpNoticeTriggered.php b/src/Event/Events/Test/Issue/PhpNoticeTriggered.php index f03d0ba9efb..41f77767809 100644 --- a/src/Event/Events/Test/Issue/PhpNoticeTriggered.php +++ b/src/Event/Events/Test/Issue/PhpNoticeTriggered.php @@ -20,27 +20,27 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PhpNoticeTriggered implements Event +final readonly class PhpNoticeTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; + private Telemetry\Info $telemetryInfo; + private Test $test; /** * @psalm-var non-empty-string */ - private readonly string $message; + private string $message; /** * @psalm-var non-empty-string */ - private readonly string $file; + private string $file; /** * @psalm-var positive-int */ - private readonly int $line; - private readonly bool $suppressed; - private readonly bool $ignoredByBaseline; + private int $line; + private bool $suppressed; + private bool $ignoredByBaseline; /** * @psalm-param non-empty-string $message diff --git a/src/Event/Events/Test/Issue/PhpWarningTriggered.php b/src/Event/Events/Test/Issue/PhpWarningTriggered.php index a93dc73e949..6365ba237a8 100644 --- a/src/Event/Events/Test/Issue/PhpWarningTriggered.php +++ b/src/Event/Events/Test/Issue/PhpWarningTriggered.php @@ -20,27 +20,27 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PhpWarningTriggered implements Event +final readonly class PhpWarningTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; + private Telemetry\Info $telemetryInfo; + private Test $test; /** * @psalm-var non-empty-string */ - private readonly string $message; + private string $message; /** * @psalm-var non-empty-string */ - private readonly string $file; + private string $file; /** * @psalm-var positive-int */ - private readonly int $line; - private readonly bool $suppressed; - private readonly bool $ignoredByBaseline; + private int $line; + private bool $suppressed; + private bool $ignoredByBaseline; /** * @psalm-param non-empty-string $message diff --git a/src/Event/Events/Test/Issue/PhpunitDeprecationTriggered.php b/src/Event/Events/Test/Issue/PhpunitDeprecationTriggered.php index fadc46d2fb8..bd91860738f 100644 --- a/src/Event/Events/Test/Issue/PhpunitDeprecationTriggered.php +++ b/src/Event/Events/Test/Issue/PhpunitDeprecationTriggered.php @@ -20,11 +20,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PhpunitDeprecationTriggered implements Event +final readonly class PhpunitDeprecationTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private Test $test; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $message) { diff --git a/src/Event/Events/Test/Issue/PhpunitErrorTriggered.php b/src/Event/Events/Test/Issue/PhpunitErrorTriggered.php index e5b75b4d6f2..f9aec03f2dd 100644 --- a/src/Event/Events/Test/Issue/PhpunitErrorTriggered.php +++ b/src/Event/Events/Test/Issue/PhpunitErrorTriggered.php @@ -21,11 +21,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PhpunitErrorTriggered implements Event +final readonly class PhpunitErrorTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private Test $test; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $message) { diff --git a/src/Event/Events/Test/Issue/PhpunitWarningTriggered.php b/src/Event/Events/Test/Issue/PhpunitWarningTriggered.php index 6a816ee4bd1..1bfcb4d90f4 100644 --- a/src/Event/Events/Test/Issue/PhpunitWarningTriggered.php +++ b/src/Event/Events/Test/Issue/PhpunitWarningTriggered.php @@ -20,11 +20,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PhpunitWarningTriggered implements Event +final readonly class PhpunitWarningTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private Test $test; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, Test $test, string $message) { diff --git a/src/Event/Events/Test/Issue/WarningTriggered.php b/src/Event/Events/Test/Issue/WarningTriggered.php index 9bccafa1e64..b2c5caca2bc 100644 --- a/src/Event/Events/Test/Issue/WarningTriggered.php +++ b/src/Event/Events/Test/Issue/WarningTriggered.php @@ -20,27 +20,27 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class WarningTriggered implements Event +final readonly class WarningTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Test $test; + private Telemetry\Info $telemetryInfo; + private Test $test; /** * @psalm-var non-empty-string */ - private readonly string $message; + private string $message; /** * @psalm-var non-empty-string */ - private readonly string $file; + private string $file; /** * @psalm-var positive-int */ - private readonly int $line; - private readonly bool $suppressed; - private readonly bool $ignoredByBaseline; + private int $line; + private bool $suppressed; + private bool $ignoredByBaseline; /** * @psalm-param non-empty-string $message diff --git a/src/Event/Events/Test/Lifecycle/DataProviderMethodCalled.php b/src/Event/Events/Test/Lifecycle/DataProviderMethodCalled.php index 2b6becab774..5581f7dda04 100644 --- a/src/Event/Events/Test/Lifecycle/DataProviderMethodCalled.php +++ b/src/Event/Events/Test/Lifecycle/DataProviderMethodCalled.php @@ -19,11 +19,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class DataProviderMethodCalled implements Event +final readonly class DataProviderMethodCalled implements Event { - private readonly Info $telemetryInfo; - private readonly ClassMethod $testMethod; - private readonly ClassMethod $dataProviderMethod; + private Info $telemetryInfo; + private ClassMethod $testMethod; + private ClassMethod $dataProviderMethod; public function __construct(Info $telemetryInfo, ClassMethod $testMethod, ClassMethod $dataProviderMethod) { diff --git a/src/Event/Events/Test/Lifecycle/DataProviderMethodFinished.php b/src/Event/Events/Test/Lifecycle/DataProviderMethodFinished.php index 0036e4089c5..f12c0f2b9e4 100644 --- a/src/Event/Events/Test/Lifecycle/DataProviderMethodFinished.php +++ b/src/Event/Events/Test/Lifecycle/DataProviderMethodFinished.php @@ -21,15 +21,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class DataProviderMethodFinished implements Event +final readonly class DataProviderMethodFinished implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly ClassMethod $testMethod; + private Telemetry\Info $telemetryInfo; + private ClassMethod $testMethod; /** * @psalm-var list */ - private readonly array $calledMethods; + private array $calledMethods; public function __construct(Telemetry\Info $telemetryInfo, ClassMethod $testMethod, ClassMethod ...$calledMethods) { diff --git a/src/Event/Events/Test/Lifecycle/Finished.php b/src/Event/Events/Test/Lifecycle/Finished.php index fd8281520e8..72032cf7137 100644 --- a/src/Event/Events/Test/Lifecycle/Finished.php +++ b/src/Event/Events/Test/Lifecycle/Finished.php @@ -19,11 +19,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Finished implements Event +final readonly class Finished implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; - private readonly int $numberOfAssertionsPerformed; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; + private int $numberOfAssertionsPerformed; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test, int $numberOfAssertionsPerformed) { diff --git a/src/Event/Events/Test/Lifecycle/PreparationFailed.php b/src/Event/Events/Test/Lifecycle/PreparationFailed.php index 4989d9ee8a8..7380be938f4 100644 --- a/src/Event/Events/Test/Lifecycle/PreparationFailed.php +++ b/src/Event/Events/Test/Lifecycle/PreparationFailed.php @@ -19,10 +19,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PreparationFailed implements Event +final readonly class PreparationFailed implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test) { diff --git a/src/Event/Events/Test/Lifecycle/PreparationStarted.php b/src/Event/Events/Test/Lifecycle/PreparationStarted.php index a6e8b8a03cf..6e975a622ee 100644 --- a/src/Event/Events/Test/Lifecycle/PreparationStarted.php +++ b/src/Event/Events/Test/Lifecycle/PreparationStarted.php @@ -19,10 +19,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PreparationStarted implements Event +final readonly class PreparationStarted implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test) { diff --git a/src/Event/Events/Test/Lifecycle/Prepared.php b/src/Event/Events/Test/Lifecycle/Prepared.php index 25075855575..9e7cc694934 100644 --- a/src/Event/Events/Test/Lifecycle/Prepared.php +++ b/src/Event/Events/Test/Lifecycle/Prepared.php @@ -19,10 +19,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Prepared implements Event +final readonly class Prepared implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test) { diff --git a/src/Event/Events/Test/Outcome/Errored.php b/src/Event/Events/Test/Outcome/Errored.php index 0c3f4aa27d2..2a2c81e9189 100644 --- a/src/Event/Events/Test/Outcome/Errored.php +++ b/src/Event/Events/Test/Outcome/Errored.php @@ -22,11 +22,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Errored implements Event +final readonly class Errored implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; - private readonly Throwable $throwable; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; + private Throwable $throwable; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test, Throwable $throwable) { diff --git a/src/Event/Events/Test/Outcome/Failed.php b/src/Event/Events/Test/Outcome/Failed.php index 0bce79efecc..6a6b8904c02 100644 --- a/src/Event/Events/Test/Outcome/Failed.php +++ b/src/Event/Events/Test/Outcome/Failed.php @@ -23,12 +23,12 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Failed implements Event +final readonly class Failed implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; - private readonly Throwable $throwable; - private readonly ?ComparisonFailure $comparisonFailure; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; + private Throwable $throwable; + private ?ComparisonFailure $comparisonFailure; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test, Throwable $throwable, ?ComparisonFailure $comparisonFailure) { diff --git a/src/Event/Events/Test/Outcome/MarkedIncomplete.php b/src/Event/Events/Test/Outcome/MarkedIncomplete.php index c501fa46c8e..0b7a5cf8c4d 100644 --- a/src/Event/Events/Test/Outcome/MarkedIncomplete.php +++ b/src/Event/Events/Test/Outcome/MarkedIncomplete.php @@ -22,11 +22,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MarkedIncomplete implements Event +final readonly class MarkedIncomplete implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; - private readonly Throwable $throwable; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; + private Throwable $throwable; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test, Throwable $throwable) { diff --git a/src/Event/Events/Test/Outcome/Passed.php b/src/Event/Events/Test/Outcome/Passed.php index 256923d49a3..8eed03daf24 100644 --- a/src/Event/Events/Test/Outcome/Passed.php +++ b/src/Event/Events/Test/Outcome/Passed.php @@ -19,10 +19,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Passed implements Event +final readonly class Passed implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test) { diff --git a/src/Event/Events/Test/Outcome/Skipped.php b/src/Event/Events/Test/Outcome/Skipped.php index 14501058a05..2070c0cfbd2 100644 --- a/src/Event/Events/Test/Outcome/Skipped.php +++ b/src/Event/Events/Test/Outcome/Skipped.php @@ -20,11 +20,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Skipped implements Event +final readonly class Skipped implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Code\Test $test; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private Code\Test $test; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, Code\Test $test, string $message) { diff --git a/src/Event/Events/Test/PrintedUnexpectedOutput.php b/src/Event/Events/Test/PrintedUnexpectedOutput.php index 733520e69b9..e2479fbbfb1 100644 --- a/src/Event/Events/Test/PrintedUnexpectedOutput.php +++ b/src/Event/Events/Test/PrintedUnexpectedOutput.php @@ -18,14 +18,14 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PrintedUnexpectedOutput implements Event +final readonly class PrintedUnexpectedOutput implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var non-empty-string */ - private readonly string $output; + private string $output; /** * @psalm-param non-empty-string $output diff --git a/src/Event/Events/Test/TestDouble/MockObjectCreated.php b/src/Event/Events/Test/TestDouble/MockObjectCreated.php index ad462440fa1..357d930aa3f 100644 --- a/src/Event/Events/Test/TestDouble/MockObjectCreated.php +++ b/src/Event/Events/Test/TestDouble/MockObjectCreated.php @@ -18,14 +18,14 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MockObjectCreated implements Event +final readonly class MockObjectCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php b/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php index 7976a1c9d06..115f1be106d 100644 --- a/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php +++ b/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php @@ -18,14 +18,14 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MockObjectForAbstractClassCreated implements Event +final readonly class MockObjectForAbstractClassCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreated.php b/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreated.php index deb7ec75d93..08176afc0ef 100644 --- a/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreated.php +++ b/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreated.php @@ -19,14 +19,14 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MockObjectForIntersectionOfInterfacesCreated implements Event +final readonly class MockObjectForIntersectionOfInterfacesCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var list */ - private readonly array $interfaces; + private array $interfaces; /** * @psalm-param list $interfaces diff --git a/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php b/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php index fd09d5949cb..fe58c57d715 100644 --- a/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php +++ b/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php @@ -18,14 +18,14 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MockObjectForTraitCreated implements Event +final readonly class MockObjectForTraitCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var trait-string */ - private readonly string $traitName; + private string $traitName; /** * @psalm-param trait-string $traitName diff --git a/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php b/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php index 09992831d45..5eda4b8a37d 100644 --- a/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php +++ b/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php @@ -18,27 +18,27 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MockObjectFromWsdlCreated implements Event +final readonly class MockObjectFromWsdlCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly string $wsdlFile; + private Telemetry\Info $telemetryInfo; + private string $wsdlFile; /** * @psalm-var class-string */ - private readonly string $originalClassName; + private string $originalClassName; /** * @psalm-var class-string */ - private readonly string $mockClassName; + private string $mockClassName; /** * @psalm-var list */ - private readonly array $methods; - private readonly bool $callOriginalConstructor; - private readonly array $options; + private array $methods; + private bool $callOriginalConstructor; + private array $options; /** * @psalm-param class-string $originalClassName diff --git a/src/Event/Events/Test/TestDouble/PartialMockObjectCreated.php b/src/Event/Events/Test/TestDouble/PartialMockObjectCreated.php index 604ba3ce083..a6c97dc266e 100644 --- a/src/Event/Events/Test/TestDouble/PartialMockObjectCreated.php +++ b/src/Event/Events/Test/TestDouble/PartialMockObjectCreated.php @@ -18,19 +18,19 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PartialMockObjectCreated implements Event +final readonly class PartialMockObjectCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var list */ - private readonly array $methodNames; + private array $methodNames; /** * @psalm-param class-string $className diff --git a/src/Event/Events/Test/TestDouble/TestProxyCreated.php b/src/Event/Events/Test/TestDouble/TestProxyCreated.php index 3f089412849..4cd4545b976 100644 --- a/src/Event/Events/Test/TestDouble/TestProxyCreated.php +++ b/src/Event/Events/Test/TestDouble/TestProxyCreated.php @@ -18,15 +18,15 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class TestProxyCreated implements Event +final readonly class TestProxyCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $className; - private readonly string $constructorArguments; + private string $className; + private string $constructorArguments; /** * @psalm-param class-string $className diff --git a/src/Event/Events/Test/TestDouble/TestStubCreated.php b/src/Event/Events/Test/TestDouble/TestStubCreated.php index 9d0330f6f93..424d9f44f20 100644 --- a/src/Event/Events/Test/TestDouble/TestStubCreated.php +++ b/src/Event/Events/Test/TestDouble/TestStubCreated.php @@ -18,14 +18,14 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class TestStubCreated implements Event +final readonly class TestStubCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Event/Events/Test/TestDouble/TestStubForIntersectionOfInterfacesCreated.php b/src/Event/Events/Test/TestDouble/TestStubForIntersectionOfInterfacesCreated.php index 4aded8c83cf..fb4dccdd5a3 100644 --- a/src/Event/Events/Test/TestDouble/TestStubForIntersectionOfInterfacesCreated.php +++ b/src/Event/Events/Test/TestDouble/TestStubForIntersectionOfInterfacesCreated.php @@ -19,14 +19,14 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class TestStubForIntersectionOfInterfacesCreated implements Event +final readonly class TestStubForIntersectionOfInterfacesCreated implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var list */ - private readonly array $interfaces; + private array $interfaces; /** * @psalm-param list $interfaces diff --git a/src/Event/Events/TestRunner/BootstrapFinished.php b/src/Event/Events/TestRunner/BootstrapFinished.php index 9ec3f348a11..c92b7a647e1 100644 --- a/src/Event/Events/TestRunner/BootstrapFinished.php +++ b/src/Event/Events/TestRunner/BootstrapFinished.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class BootstrapFinished implements Event +final readonly class BootstrapFinished implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly string $filename; + private Telemetry\Info $telemetryInfo; + private string $filename; public function __construct(Telemetry\Info $telemetryInfo, string $filename) { diff --git a/src/Event/Events/TestRunner/Configured.php b/src/Event/Events/TestRunner/Configured.php index e27fd7b870c..4bbbc24be55 100644 --- a/src/Event/Events/TestRunner/Configured.php +++ b/src/Event/Events/TestRunner/Configured.php @@ -16,10 +16,10 @@ /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Configured implements Event +final readonly class Configured implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly Configuration $configuration; + private Telemetry\Info $telemetryInfo; + private Configuration $configuration; public function __construct(Telemetry\Info $telemetryInfo, Configuration $configuration) { diff --git a/src/Event/Events/TestRunner/DeprecationTriggered.php b/src/Event/Events/TestRunner/DeprecationTriggered.php index 31d27e2816d..0ee029959fd 100644 --- a/src/Event/Events/TestRunner/DeprecationTriggered.php +++ b/src/Event/Events/TestRunner/DeprecationTriggered.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class DeprecationTriggered implements Event +final readonly class DeprecationTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, string $message) { diff --git a/src/Event/Events/TestRunner/EventFacadeSealed.php b/src/Event/Events/TestRunner/EventFacadeSealed.php index ea8ab985e9b..bbcc3904c78 100644 --- a/src/Event/Events/TestRunner/EventFacadeSealed.php +++ b/src/Event/Events/TestRunner/EventFacadeSealed.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class EventFacadeSealed implements Event +final readonly class EventFacadeSealed implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; public function __construct(Telemetry\Info $telemetryInfo) { diff --git a/src/Event/Events/TestRunner/ExecutionAborted.php b/src/Event/Events/TestRunner/ExecutionAborted.php index 2e2b92cedfd..635a3b4308a 100644 --- a/src/Event/Events/TestRunner/ExecutionAborted.php +++ b/src/Event/Events/TestRunner/ExecutionAborted.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ExecutionAborted implements Event +final readonly class ExecutionAborted implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; public function __construct(Telemetry\Info $telemetryInfo) { diff --git a/src/Event/Events/TestRunner/ExecutionFinished.php b/src/Event/Events/TestRunner/ExecutionFinished.php index 5496d1e6fbb..c1d725aea3f 100644 --- a/src/Event/Events/TestRunner/ExecutionFinished.php +++ b/src/Event/Events/TestRunner/ExecutionFinished.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ExecutionFinished implements Event +final readonly class ExecutionFinished implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; public function __construct(Telemetry\Info $telemetryInfo) { diff --git a/src/Event/Events/TestRunner/ExecutionStarted.php b/src/Event/Events/TestRunner/ExecutionStarted.php index 77fd570d7f9..a3aa38a6018 100644 --- a/src/Event/Events/TestRunner/ExecutionStarted.php +++ b/src/Event/Events/TestRunner/ExecutionStarted.php @@ -19,10 +19,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ExecutionStarted implements Event +final readonly class ExecutionStarted implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly TestSuite $testSuite; + private Telemetry\Info $telemetryInfo; + private TestSuite $testSuite; public function __construct(Telemetry\Info $telemetryInfo, TestSuite $testSuite) { diff --git a/src/Event/Events/TestRunner/ExtensionBootstrapped.php b/src/Event/Events/TestRunner/ExtensionBootstrapped.php index 8ef3ff1b8d1..1760fa3a08c 100644 --- a/src/Event/Events/TestRunner/ExtensionBootstrapped.php +++ b/src/Event/Events/TestRunner/ExtensionBootstrapped.php @@ -18,19 +18,19 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ExtensionBootstrapped implements Event +final readonly class ExtensionBootstrapped implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var array */ - private readonly array $parameters; + private array $parameters; /** * @psalm-param class-string $className diff --git a/src/Event/Events/TestRunner/ExtensionLoadedFromPhar.php b/src/Event/Events/TestRunner/ExtensionLoadedFromPhar.php index a2f1f1476f6..2e11f04d3f7 100644 --- a/src/Event/Events/TestRunner/ExtensionLoadedFromPhar.php +++ b/src/Event/Events/TestRunner/ExtensionLoadedFromPhar.php @@ -18,12 +18,12 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ExtensionLoadedFromPhar implements Event +final readonly class ExtensionLoadedFromPhar implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly string $filename; - private readonly string $name; - private readonly string $version; + private Telemetry\Info $telemetryInfo; + private string $filename; + private string $name; + private string $version; public function __construct(Telemetry\Info $telemetryInfo, string $filename, string $name, string $version) { diff --git a/src/Event/Events/TestRunner/Finished.php b/src/Event/Events/TestRunner/Finished.php index 3b984068b75..9133acc4418 100644 --- a/src/Event/Events/TestRunner/Finished.php +++ b/src/Event/Events/TestRunner/Finished.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Finished implements Event +final readonly class Finished implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; public function __construct(Telemetry\Info $telemetryInfo) { diff --git a/src/Event/Events/TestRunner/GarbageCollectionDisabled.php b/src/Event/Events/TestRunner/GarbageCollectionDisabled.php index b7ac6a0556e..2690f69c565 100644 --- a/src/Event/Events/TestRunner/GarbageCollectionDisabled.php +++ b/src/Event/Events/TestRunner/GarbageCollectionDisabled.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class GarbageCollectionDisabled implements Event +final readonly class GarbageCollectionDisabled implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; public function __construct(Telemetry\Info $telemetryInfo) { diff --git a/src/Event/Events/TestRunner/GarbageCollectionEnabled.php b/src/Event/Events/TestRunner/GarbageCollectionEnabled.php index 9f3e8b8bb53..cabeed434c0 100644 --- a/src/Event/Events/TestRunner/GarbageCollectionEnabled.php +++ b/src/Event/Events/TestRunner/GarbageCollectionEnabled.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class GarbageCollectionEnabled implements Event +final readonly class GarbageCollectionEnabled implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; public function __construct(Telemetry\Info $telemetryInfo) { diff --git a/src/Event/Events/TestRunner/GarbageCollectionTriggered.php b/src/Event/Events/TestRunner/GarbageCollectionTriggered.php index 5ab2f82898e..ade9ea5e861 100644 --- a/src/Event/Events/TestRunner/GarbageCollectionTriggered.php +++ b/src/Event/Events/TestRunner/GarbageCollectionTriggered.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class GarbageCollectionTriggered implements Event +final readonly class GarbageCollectionTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; public function __construct(Telemetry\Info $telemetryInfo) { diff --git a/src/Event/Events/TestRunner/Started.php b/src/Event/Events/TestRunner/Started.php index fd2f494a62a..ec18d665482 100644 --- a/src/Event/Events/TestRunner/Started.php +++ b/src/Event/Events/TestRunner/Started.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Started implements Event +final readonly class Started implements Event { - private readonly Telemetry\Info $telemetryInfo; + private Telemetry\Info $telemetryInfo; public function __construct(Telemetry\Info $telemetryInfo) { diff --git a/src/Event/Events/TestRunner/WarningTriggered.php b/src/Event/Events/TestRunner/WarningTriggered.php index cb80a07ba5f..be424027545 100644 --- a/src/Event/Events/TestRunner/WarningTriggered.php +++ b/src/Event/Events/TestRunner/WarningTriggered.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class WarningTriggered implements Event +final readonly class WarningTriggered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, string $message) { diff --git a/src/Event/Events/TestSuite/Filtered.php b/src/Event/Events/TestSuite/Filtered.php index 1beadde5e7f..29b6c8ee616 100644 --- a/src/Event/Events/TestSuite/Filtered.php +++ b/src/Event/Events/TestSuite/Filtered.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Filtered implements Event +final readonly class Filtered implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly TestSuite $testSuite; + private Telemetry\Info $telemetryInfo; + private TestSuite $testSuite; public function __construct(Telemetry\Info $telemetryInfo, TestSuite $testSuite) { diff --git a/src/Event/Events/TestSuite/Finished.php b/src/Event/Events/TestSuite/Finished.php index e89076c12b4..e729b72b661 100644 --- a/src/Event/Events/TestSuite/Finished.php +++ b/src/Event/Events/TestSuite/Finished.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Finished implements Event +final readonly class Finished implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly TestSuite $testSuite; + private Telemetry\Info $telemetryInfo; + private TestSuite $testSuite; public function __construct(Telemetry\Info $telemetryInfo, TestSuite $testSuite) { diff --git a/src/Event/Events/TestSuite/Loaded.php b/src/Event/Events/TestSuite/Loaded.php index 271ab37f59e..9f2aaa7479d 100644 --- a/src/Event/Events/TestSuite/Loaded.php +++ b/src/Event/Events/TestSuite/Loaded.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Loaded implements Event +final readonly class Loaded implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly TestSuite $testSuite; + private Telemetry\Info $telemetryInfo; + private TestSuite $testSuite; public function __construct(Telemetry\Info $telemetryInfo, TestSuite $testSuite) { diff --git a/src/Event/Events/TestSuite/Skipped.php b/src/Event/Events/TestSuite/Skipped.php index 9a8f52309a3..c1692e4a3c8 100644 --- a/src/Event/Events/TestSuite/Skipped.php +++ b/src/Event/Events/TestSuite/Skipped.php @@ -18,11 +18,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Skipped implements Event +final readonly class Skipped implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly TestSuite $testSuite; - private readonly string $message; + private Telemetry\Info $telemetryInfo; + private TestSuite $testSuite; + private string $message; public function __construct(Telemetry\Info $telemetryInfo, TestSuite $testSuite, string $message) { diff --git a/src/Event/Events/TestSuite/Sorted.php b/src/Event/Events/TestSuite/Sorted.php index ae2b53cdd4c..e0dbf1b94c5 100644 --- a/src/Event/Events/TestSuite/Sorted.php +++ b/src/Event/Events/TestSuite/Sorted.php @@ -17,12 +17,12 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Sorted implements Event +final readonly class Sorted implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly int $executionOrder; - private readonly int $executionOrderDefects; - private readonly bool $resolveDependencies; + private Telemetry\Info $telemetryInfo; + private int $executionOrder; + private int $executionOrderDefects; + private bool $resolveDependencies; public function __construct(Telemetry\Info $telemetryInfo, int $executionOrder, int $executionOrderDefects, bool $resolveDependencies) { diff --git a/src/Event/Events/TestSuite/Started.php b/src/Event/Events/TestSuite/Started.php index 1e34aa7d93e..25ba7be9657 100644 --- a/src/Event/Events/TestSuite/Started.php +++ b/src/Event/Events/TestSuite/Started.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Started implements Event +final readonly class Started implements Event { - private readonly Telemetry\Info $telemetryInfo; - private readonly TestSuite $testSuite; + private Telemetry\Info $telemetryInfo; + private TestSuite $testSuite; public function __construct(Telemetry\Info $telemetryInfo, TestSuite $testSuite) { diff --git a/src/Event/Value/ClassMethod.php b/src/Event/Value/ClassMethod.php index 5b7d56c2b10..5eb58ba72a8 100644 --- a/src/Event/Value/ClassMethod.php +++ b/src/Event/Value/ClassMethod.php @@ -14,17 +14,17 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ClassMethod +final readonly class ClassMethod { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param class-string $className diff --git a/src/Event/Value/ComparisonFailure.php b/src/Event/Value/ComparisonFailure.php index b8e5cc93422..9b88901a31f 100644 --- a/src/Event/Value/ComparisonFailure.php +++ b/src/Event/Value/ComparisonFailure.php @@ -14,11 +14,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ComparisonFailure +final readonly class ComparisonFailure { - private readonly string $expected; - private readonly string $actual; - private readonly string $diff; + private string $expected; + private string $actual; + private string $diff; public function __construct(string $expected, string $actual, string $diff) { diff --git a/src/Event/Value/Runtime/OperatingSystem.php b/src/Event/Value/Runtime/OperatingSystem.php index a901be4303d..628c439221e 100644 --- a/src/Event/Value/Runtime/OperatingSystem.php +++ b/src/Event/Value/Runtime/OperatingSystem.php @@ -17,10 +17,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class OperatingSystem +final readonly class OperatingSystem { - private readonly string $operatingSystem; - private readonly string $operatingSystemFamily; + private string $operatingSystem; + private string $operatingSystemFamily; public function __construct() { diff --git a/src/Event/Value/Runtime/PHP.php b/src/Event/Value/Runtime/PHP.php index 717f3c12090..e81953d1f52 100644 --- a/src/Event/Value/Runtime/PHP.php +++ b/src/Event/Value/Runtime/PHP.php @@ -25,20 +25,20 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PHP +final readonly class PHP { - private readonly string $version; - private readonly int $versionId; - private readonly int $majorVersion; - private readonly int $minorVersion; - private readonly int $releaseVersion; - private readonly string $extraVersion; - private readonly string $sapi; + private string $version; + private int $versionId; + private int $majorVersion; + private int $minorVersion; + private int $releaseVersion; + private string $extraVersion; + private string $sapi; /** * @psalm-var list */ - private readonly array $extensions; + private array $extensions; public function __construct() { diff --git a/src/Event/Value/Runtime/PHPUnit.php b/src/Event/Value/Runtime/PHPUnit.php index f6fb037547f..c4006bc15c8 100644 --- a/src/Event/Value/Runtime/PHPUnit.php +++ b/src/Event/Value/Runtime/PHPUnit.php @@ -16,10 +16,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class PHPUnit +final readonly class PHPUnit { - private readonly string $versionId; - private readonly string $releaseSeries; + private string $versionId; + private string $releaseSeries; public function __construct() { diff --git a/src/Event/Value/Runtime/Runtime.php b/src/Event/Value/Runtime/Runtime.php index cea7ba32270..406393c2698 100644 --- a/src/Event/Value/Runtime/Runtime.php +++ b/src/Event/Value/Runtime/Runtime.php @@ -16,11 +16,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Runtime +final readonly class Runtime { - private readonly OperatingSystem $operatingSystem; - private readonly PHP $php; - private readonly PHPUnit $phpunit; + private OperatingSystem $operatingSystem; + private PHP $php; + private PHPUnit $phpunit; public function __construct() { diff --git a/src/Event/Value/Telemetry/Duration.php b/src/Event/Value/Telemetry/Duration.php index 000216cd4ca..40ded7b1b73 100644 --- a/src/Event/Value/Telemetry/Duration.php +++ b/src/Event/Value/Telemetry/Duration.php @@ -18,10 +18,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Duration +final readonly class Duration { - private readonly int $seconds; - private readonly int $nanoseconds; + private int $seconds; + private int $nanoseconds; /** * @throws InvalidArgumentException diff --git a/src/Event/Value/Telemetry/GarbageCollectorStatus.php b/src/Event/Value/Telemetry/GarbageCollectorStatus.php index 51a5ac68e9d..e1eec1bf7f7 100644 --- a/src/Event/Value/Telemetry/GarbageCollectorStatus.php +++ b/src/Event/Value/Telemetry/GarbageCollectorStatus.php @@ -16,20 +16,20 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class GarbageCollectorStatus +final readonly class GarbageCollectorStatus { - private readonly int $runs; - private readonly int $collected; - private readonly int $threshold; - private readonly int $roots; - private readonly ?float $applicationTime; - private readonly ?float $collectorTime; - private readonly ?float $destructorTime; - private readonly ?float $freeTime; - private readonly ?bool $running; - private readonly ?bool $protected; - private readonly ?bool $full; - private readonly ?int $bufferSize; + private int $runs; + private int $collected; + private int $threshold; + private int $roots; + private ?float $applicationTime; + private ?float $collectorTime; + private ?float $destructorTime; + private ?float $freeTime; + private ?bool $running; + private ?bool $protected; + private ?bool $full; + private ?int $bufferSize; public function __construct(int $runs, int $collected, int $threshold, int $roots, ?float $applicationTime, ?float $collectorTime, ?float $destructorTime, ?float $freeTime, ?bool $running, ?bool $protected, ?bool $full, ?int $bufferSize) { diff --git a/src/Event/Value/Telemetry/HRTime.php b/src/Event/Value/Telemetry/HRTime.php index 5a82ebb8735..96e0e559a5a 100644 --- a/src/Event/Value/Telemetry/HRTime.php +++ b/src/Event/Value/Telemetry/HRTime.php @@ -17,10 +17,10 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class HRTime +final readonly class HRTime { - private readonly int $seconds; - private readonly int $nanoseconds; + private int $seconds; + private int $nanoseconds; /** * @throws InvalidArgumentException diff --git a/src/Event/Value/Telemetry/Info.php b/src/Event/Value/Telemetry/Info.php index 1546d94033f..94b2afea2e9 100644 --- a/src/Event/Value/Telemetry/Info.php +++ b/src/Event/Value/Telemetry/Info.php @@ -16,13 +16,13 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Info +final readonly class Info { - private readonly Snapshot $current; - private readonly Duration $durationSinceStart; - private readonly MemoryUsage $memorySinceStart; - private readonly Duration $durationSincePrevious; - private readonly MemoryUsage $memorySincePrevious; + private Snapshot $current; + private Duration $durationSinceStart; + private MemoryUsage $memorySinceStart; + private Duration $durationSincePrevious; + private MemoryUsage $memorySincePrevious; public function __construct(Snapshot $current, Duration $durationSinceStart, MemoryUsage $memorySinceStart, Duration $durationSincePrevious, MemoryUsage $memorySincePrevious) { diff --git a/src/Event/Value/Telemetry/MemoryUsage.php b/src/Event/Value/Telemetry/MemoryUsage.php index 7e8bc699c0b..384fa7d0d82 100644 --- a/src/Event/Value/Telemetry/MemoryUsage.php +++ b/src/Event/Value/Telemetry/MemoryUsage.php @@ -14,9 +14,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MemoryUsage +final readonly class MemoryUsage { - private readonly int $bytes; + private int $bytes; public static function fromBytes(int $bytes): self { diff --git a/src/Event/Value/Telemetry/Snapshot.php b/src/Event/Value/Telemetry/Snapshot.php index 6c5a165949e..29fc1407200 100644 --- a/src/Event/Value/Telemetry/Snapshot.php +++ b/src/Event/Value/Telemetry/Snapshot.php @@ -14,12 +14,12 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Snapshot +final readonly class Snapshot { - private readonly HRTime $time; - private readonly MemoryUsage $memoryUsage; - private readonly MemoryUsage $peakMemoryUsage; - private readonly GarbageCollectorStatus $garbageCollectorStatus; + private HRTime $time; + private MemoryUsage $memoryUsage; + private MemoryUsage $peakMemoryUsage; + private GarbageCollectorStatus $garbageCollectorStatus; public function __construct(HRTime $time, MemoryUsage $memoryUsage, MemoryUsage $peakMemoryUsage, GarbageCollectorStatus $garbageCollectorStatus) { diff --git a/src/Event/Value/Telemetry/System.php b/src/Event/Value/Telemetry/System.php index 53b394da8f7..e8bcab255e1 100644 --- a/src/Event/Value/Telemetry/System.php +++ b/src/Event/Value/Telemetry/System.php @@ -12,11 +12,11 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class System +final readonly class System { - private readonly StopWatch $stopWatch; - private readonly MemoryMeter $memoryMeter; - private readonly GarbageCollectorStatusProvider $garbageCollectorStatusProvider; + private StopWatch $stopWatch; + private MemoryMeter $memoryMeter; + private GarbageCollectorStatusProvider $garbageCollectorStatusProvider; public function __construct(StopWatch $stopWatch, MemoryMeter $memoryMeter, GarbageCollectorStatusProvider $garbageCollectorStatusProvider) { diff --git a/src/Event/Value/Test/TestCollection.php b/src/Event/Value/Test/TestCollection.php index 2656e1ce8f9..e5710468432 100644 --- a/src/Event/Value/Test/TestCollection.php +++ b/src/Event/Value/Test/TestCollection.php @@ -20,12 +20,12 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class TestCollection implements Countable, IteratorAggregate +final readonly class TestCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $tests; + private array $tests; /** * @psalm-param list $tests diff --git a/src/Event/Value/Test/TestData/TestDataCollection.php b/src/Event/Value/Test/TestData/TestDataCollection.php index 55012259767..8f8047a5319 100644 --- a/src/Event/Value/Test/TestData/TestDataCollection.php +++ b/src/Event/Value/Test/TestData/TestDataCollection.php @@ -28,20 +28,19 @@ final class TestDataCollection implements Countable, IteratorAggregate /** * @psalm-param list $data - * - * @throws MoreThanOneDataSetFromDataProviderException */ public static function fromArray(array $data): self { return new self(...$data); } - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ private function __construct(TestData ...$data) { - $this->ensureNoMoreThanOneDataFromDataProvider($data); + foreach ($data as $_data) { + if ($_data->isFromDataProvider()) { + $this->fromDataProvider = $_data; + } + } $this->data = $data; } @@ -83,22 +82,4 @@ public function getIterator(): TestDataCollectionIterator { return new TestDataCollectionIterator($this); } - - /** - * @psalm-param list $data - * - * @throws MoreThanOneDataSetFromDataProviderException - */ - private function ensureNoMoreThanOneDataFromDataProvider(array $data): void - { - foreach ($data as $_data) { - if ($_data->isFromDataProvider()) { - if ($this->fromDataProvider !== null) { - throw new MoreThanOneDataSetFromDataProviderException; - } - - $this->fromDataProvider = $_data; - } - } - } } diff --git a/src/Event/Value/Test/TestDox.php b/src/Event/Value/Test/TestDox.php index 948d55fd3a5..2703a368500 100644 --- a/src/Event/Value/Test/TestDox.php +++ b/src/Event/Value/Test/TestDox.php @@ -14,11 +14,11 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class TestDox +final readonly class TestDox { - private readonly string $prettifiedClassName; - private readonly string $prettifiedMethodName; - private readonly string $prettifiedAndColorizedMethodName; + private string $prettifiedClassName; + private string $prettifiedMethodName; + private string $prettifiedAndColorizedMethodName; public function __construct(string $prettifiedClassName, string $prettifiedMethodName, string $prettifiedAndColorizedMethodName) { diff --git a/src/Event/Value/Test/TestDoxBuilder.php b/src/Event/Value/Test/TestDoxBuilder.php index 2c17469815d..edad458748c 100644 --- a/src/Event/Value/Test/TestDoxBuilder.php +++ b/src/Event/Value/Test/TestDoxBuilder.php @@ -9,7 +9,6 @@ */ namespace PHPUnit\Event\Code; -use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException; use PHPUnit\Framework\TestCase; use PHPUnit\Logging\TestDox\NamePrettifier; @@ -18,9 +17,6 @@ */ final class TestDoxBuilder { - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ public static function fromTestCase(TestCase $testCase): TestDox { $prettifier = new NamePrettifier; diff --git a/src/Event/Value/Test/TestMethodBuilder.php b/src/Event/Value/Test/TestMethodBuilder.php index 8d413f63c9c..8a276fec0bd 100644 --- a/src/Event/Value/Test/TestMethodBuilder.php +++ b/src/Event/Value/Test/TestMethodBuilder.php @@ -15,7 +15,6 @@ use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Event\TestData\DataFromDataProvider; use PHPUnit\Event\TestData\DataFromTestDependency; -use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException; use PHPUnit\Event\TestData\TestDataCollection; use PHPUnit\Framework\TestCase; use PHPUnit\Metadata\Parser\Registry as MetadataRegistry; @@ -27,9 +26,6 @@ */ final class TestMethodBuilder { - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ public static function fromTestCase(TestCase $testCase): TestMethod { $methodName = $testCase->name(); @@ -63,9 +59,6 @@ public static function fromCallStack(): TestMethod throw new NoTestCaseObjectOnCallStackException; } - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ private static function dataFor(TestCase $testCase): TestDataCollection { $testData = []; diff --git a/src/Event/Value/Throwable.php b/src/Event/Value/Throwable.php index f94a8a22201..c294de51e44 100644 --- a/src/Event/Value/Throwable.php +++ b/src/Event/Value/Throwable.php @@ -17,16 +17,16 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class Throwable +final readonly class Throwable { /** * @psalm-var class-string */ - private readonly string $className; - private readonly string $message; - private readonly string $description; - private readonly string $stackTrace; - private readonly ?Throwable $previous; + private string $className; + private string $message; + private string $description; + private string $stackTrace; + private ?Throwable $previous; /** * @psalm-param class-string $className diff --git a/src/Framework/Assert.php b/src/Framework/Assert.php index 6694fb6c024..83684b04d25 100644 --- a/src/Framework/Assert.php +++ b/src/Framework/Assert.php @@ -1617,6 +1617,11 @@ final public static function assertStringMatchesFormat(string $format, string $s */ final public static function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + null, + 'assertStringNotMatchesFormat() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + static::assertThat( $string, new LogicalNot( @@ -1653,6 +1658,11 @@ final public static function assertStringMatchesFormatFile(string $formatFile, s */ final public static function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + null, + 'assertStringNotMatchesFormatFile() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + static::assertFileExists($formatFile, $message); static::assertThat( @@ -2132,7 +2142,7 @@ final public static function isList(): IsList final public static function equalTo(mixed $value): IsEqual { - return new IsEqual($value, 0.0, false, false); + return new IsEqual($value); } final public static function equalToCanonicalizing(mixed $value): IsEqualCanonicalizing diff --git a/src/Framework/Attributes/BackupGlobals.php b/src/Framework/Attributes/BackupGlobals.php index 481687e459c..c212cdbd0e1 100644 --- a/src/Framework/Attributes/BackupGlobals.php +++ b/src/Framework/Attributes/BackupGlobals.php @@ -17,9 +17,9 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class BackupGlobals +final readonly class BackupGlobals { - private readonly bool $enabled; + private bool $enabled; public function __construct(bool $enabled) { diff --git a/src/Framework/Attributes/BackupStaticProperties.php b/src/Framework/Attributes/BackupStaticProperties.php index 8fa215b0b90..6c80565bedf 100644 --- a/src/Framework/Attributes/BackupStaticProperties.php +++ b/src/Framework/Attributes/BackupStaticProperties.php @@ -17,9 +17,9 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class BackupStaticProperties +final readonly class BackupStaticProperties { - private readonly bool $enabled; + private bool $enabled; public function __construct(bool $enabled) { diff --git a/src/Framework/Attributes/CoversClass.php b/src/Framework/Attributes/CoversClass.php index 9b070c8af0f..ea2b49b98f5 100644 --- a/src/Framework/Attributes/CoversClass.php +++ b/src/Framework/Attributes/CoversClass.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] -final class CoversClass +final readonly class CoversClass { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/CoversFunction.php b/src/Framework/Attributes/CoversFunction.php index ad0bbd283ea..1a68f00a021 100644 --- a/src/Framework/Attributes/CoversFunction.php +++ b/src/Framework/Attributes/CoversFunction.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] -final class CoversFunction +final readonly class CoversFunction { /** * @psalm-var non-empty-string */ - private readonly string $functionName; + private string $functionName; /** * @psalm-param non-empty-string $functionName diff --git a/src/Framework/Attributes/DataProvider.php b/src/Framework/Attributes/DataProvider.php index d31130fb310..d7ade647145 100644 --- a/src/Framework/Attributes/DataProvider.php +++ b/src/Framework/Attributes/DataProvider.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DataProvider +final readonly class DataProvider { /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param non-empty-string $methodName diff --git a/src/Framework/Attributes/DataProviderExternal.php b/src/Framework/Attributes/DataProviderExternal.php index 37f85868ddd..d59d85fed3e 100644 --- a/src/Framework/Attributes/DataProviderExternal.php +++ b/src/Framework/Attributes/DataProviderExternal.php @@ -17,17 +17,17 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DataProviderExternal +final readonly class DataProviderExternal { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/Depends.php b/src/Framework/Attributes/Depends.php index 38daf1efcff..124566aac87 100644 --- a/src/Framework/Attributes/Depends.php +++ b/src/Framework/Attributes/Depends.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class Depends +final readonly class Depends { /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param non-empty-string $methodName diff --git a/src/Framework/Attributes/DependsExternal.php b/src/Framework/Attributes/DependsExternal.php index ba5bc322962..31f62b44885 100644 --- a/src/Framework/Attributes/DependsExternal.php +++ b/src/Framework/Attributes/DependsExternal.php @@ -17,17 +17,17 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DependsExternal +final readonly class DependsExternal { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/DependsExternalUsingDeepClone.php b/src/Framework/Attributes/DependsExternalUsingDeepClone.php index 9e426abac28..4519ccb4fb0 100644 --- a/src/Framework/Attributes/DependsExternalUsingDeepClone.php +++ b/src/Framework/Attributes/DependsExternalUsingDeepClone.php @@ -17,17 +17,17 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DependsExternalUsingDeepClone +final readonly class DependsExternalUsingDeepClone { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/DependsExternalUsingShallowClone.php b/src/Framework/Attributes/DependsExternalUsingShallowClone.php index 5b9a85dfc00..22b2539d8d8 100644 --- a/src/Framework/Attributes/DependsExternalUsingShallowClone.php +++ b/src/Framework/Attributes/DependsExternalUsingShallowClone.php @@ -17,17 +17,17 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DependsExternalUsingShallowClone +final readonly class DependsExternalUsingShallowClone { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/DependsOnClass.php b/src/Framework/Attributes/DependsOnClass.php index 73722e36cec..e179d18c97e 100644 --- a/src/Framework/Attributes/DependsOnClass.php +++ b/src/Framework/Attributes/DependsOnClass.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DependsOnClass +final readonly class DependsOnClass { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/DependsOnClassUsingDeepClone.php b/src/Framework/Attributes/DependsOnClassUsingDeepClone.php index 7ce05476d57..b737b0ad77b 100644 --- a/src/Framework/Attributes/DependsOnClassUsingDeepClone.php +++ b/src/Framework/Attributes/DependsOnClassUsingDeepClone.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DependsOnClassUsingDeepClone +final readonly class DependsOnClassUsingDeepClone { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/DependsOnClassUsingShallowClone.php b/src/Framework/Attributes/DependsOnClassUsingShallowClone.php index 206c0add47b..91e88ee6928 100644 --- a/src/Framework/Attributes/DependsOnClassUsingShallowClone.php +++ b/src/Framework/Attributes/DependsOnClassUsingShallowClone.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DependsOnClassUsingShallowClone +final readonly class DependsOnClassUsingShallowClone { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/DependsUsingDeepClone.php b/src/Framework/Attributes/DependsUsingDeepClone.php index 11c4091c464..8879ecdee3e 100644 --- a/src/Framework/Attributes/DependsUsingDeepClone.php +++ b/src/Framework/Attributes/DependsUsingDeepClone.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DependsUsingDeepClone +final readonly class DependsUsingDeepClone { /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param non-empty-string $methodName diff --git a/src/Framework/Attributes/DependsUsingShallowClone.php b/src/Framework/Attributes/DependsUsingShallowClone.php index 0812c85c135..c844066a528 100644 --- a/src/Framework/Attributes/DependsUsingShallowClone.php +++ b/src/Framework/Attributes/DependsUsingShallowClone.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class DependsUsingShallowClone +final readonly class DependsUsingShallowClone { /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param non-empty-string $methodName diff --git a/src/Framework/Attributes/ExcludeGlobalVariableFromBackup.php b/src/Framework/Attributes/ExcludeGlobalVariableFromBackup.php index dcd7a12b0f8..4ad5b5ebc89 100644 --- a/src/Framework/Attributes/ExcludeGlobalVariableFromBackup.php +++ b/src/Framework/Attributes/ExcludeGlobalVariableFromBackup.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class ExcludeGlobalVariableFromBackup +final readonly class ExcludeGlobalVariableFromBackup { /** * @psalm-var non-empty-string */ - private readonly string $globalVariableName; + private string $globalVariableName; /** * @psalm-param non-empty-string $globalVariableName diff --git a/src/Framework/Attributes/ExcludeStaticPropertyFromBackup.php b/src/Framework/Attributes/ExcludeStaticPropertyFromBackup.php index 64b25ed5000..d516f1a9f4a 100644 --- a/src/Framework/Attributes/ExcludeStaticPropertyFromBackup.php +++ b/src/Framework/Attributes/ExcludeStaticPropertyFromBackup.php @@ -17,17 +17,17 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class ExcludeStaticPropertyFromBackup +final readonly class ExcludeStaticPropertyFromBackup { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var non-empty-string */ - private readonly string $propertyName; + private string $propertyName; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/Group.php b/src/Framework/Attributes/Group.php index feccb287cac..d1127384344 100644 --- a/src/Framework/Attributes/Group.php +++ b/src/Framework/Attributes/Group.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class Group +final readonly class Group { /** * @psalm-var non-empty-string */ - private readonly string $name; + private string $name; /** * @psalm-param non-empty-string $name diff --git a/src/Framework/Attributes/IgnoreClassForCodeCoverage.php b/src/Framework/Attributes/IgnoreClassForCodeCoverage.php deleted file mode 100644 index 28355074223..00000000000 --- a/src/Framework/Attributes/IgnoreClassForCodeCoverage.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Attributes; - -use Attribute; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 - */ -#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] -final class IgnoreClassForCodeCoverage -{ - /** - * @psalm-var class-string - */ - private readonly string $className; - - /** - * @psalm-param class-string $className - */ - public function __construct(string $className) - { - $this->className = $className; - } - - /** - * @psalm-return class-string - */ - public function className(): string - { - return $this->className; - } -} diff --git a/src/Framework/Attributes/CodeCoverageIgnore.php b/src/Framework/Attributes/IgnoreDeprecations.php similarity index 82% rename from src/Framework/Attributes/CodeCoverageIgnore.php rename to src/Framework/Attributes/IgnoreDeprecations.php index 38ec37ad458..cf48aac1eaa 100644 --- a/src/Framework/Attributes/CodeCoverageIgnore.php +++ b/src/Framework/Attributes/IgnoreDeprecations.php @@ -15,10 +15,8 @@ * @psalm-immutable * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5236 */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class CodeCoverageIgnore +final class IgnoreDeprecations { } diff --git a/src/Framework/Attributes/IgnoreFunctionForCodeCoverage.php b/src/Framework/Attributes/IgnoreFunctionForCodeCoverage.php deleted file mode 100644 index 90a4bab0e7a..00000000000 --- a/src/Framework/Attributes/IgnoreFunctionForCodeCoverage.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Attributes; - -use Attribute; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 - */ -#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] -final class IgnoreFunctionForCodeCoverage -{ - /** - * @psalm-var non-empty-string - */ - private readonly string $functionName; - - /** - * @psalm-param non-empty-string $functionName - */ - public function __construct(string $functionName) - { - $this->functionName = $functionName; - } - - /** - * @psalm-return non-empty-string - */ - public function functionName(): string - { - return $this->functionName; - } -} diff --git a/src/Framework/Attributes/IgnoreMethodForCodeCoverage.php b/src/Framework/Attributes/IgnoreMethodForCodeCoverage.php deleted file mode 100644 index a76188f9e1d..00000000000 --- a/src/Framework/Attributes/IgnoreMethodForCodeCoverage.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Attributes; - -use Attribute; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 - */ -#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] -final class IgnoreMethodForCodeCoverage -{ - /** - * @psalm-var class-string - */ - private readonly string $className; - - /** - * @psalm-var non-empty-string - */ - private readonly string $methodName; - - /** - * @psalm-param class-string $className - * @psalm-param non-empty-string $methodName - */ - public function __construct(string $className, string $methodName) - { - $this->className = $className; - $this->methodName = $methodName; - } - - /** - * @psalm-return class-string - */ - public function className(): string - { - return $this->className; - } - - /** - * @psalm-return non-empty-string - */ - public function methodName(): string - { - return $this->methodName; - } -} diff --git a/src/Framework/Attributes/IgnorePhpunitDeprecations.php b/src/Framework/Attributes/IgnorePhpunitDeprecations.php new file mode 100644 index 00000000000..35333cbb84d --- /dev/null +++ b/src/Framework/Attributes/IgnorePhpunitDeprecations.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Attributes; + +use Attribute; + +/** + * @psalm-immutable + * + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] +final class IgnorePhpunitDeprecations +{ +} diff --git a/src/Framework/Attributes/PreserveGlobalState.php b/src/Framework/Attributes/PreserveGlobalState.php index 69bc3f52ed1..3a1ae5f04a4 100644 --- a/src/Framework/Attributes/PreserveGlobalState.php +++ b/src/Framework/Attributes/PreserveGlobalState.php @@ -17,9 +17,9 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class PreserveGlobalState +final readonly class PreserveGlobalState { - private readonly bool $enabled; + private bool $enabled; public function __construct(bool $enabled) { diff --git a/src/Framework/Attributes/RequiresFunction.php b/src/Framework/Attributes/RequiresFunction.php index 250915d6605..710d3c77161 100644 --- a/src/Framework/Attributes/RequiresFunction.php +++ b/src/Framework/Attributes/RequiresFunction.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class RequiresFunction +final readonly class RequiresFunction { /** * @psalm-var non-empty-string */ - private readonly string $functionName; + private string $functionName; /** * @psalm-param non-empty-string $functionName diff --git a/src/Framework/Attributes/RequiresMethod.php b/src/Framework/Attributes/RequiresMethod.php index 120c705a3d4..34ffec11704 100644 --- a/src/Framework/Attributes/RequiresMethod.php +++ b/src/Framework/Attributes/RequiresMethod.php @@ -17,17 +17,17 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class RequiresMethod +final readonly class RequiresMethod { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var non-empty-string */ - private readonly string $methodName; + private string $methodName; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/RequiresOperatingSystem.php b/src/Framework/Attributes/RequiresOperatingSystem.php index cbf82117018..42c3bac8e37 100644 --- a/src/Framework/Attributes/RequiresOperatingSystem.php +++ b/src/Framework/Attributes/RequiresOperatingSystem.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class RequiresOperatingSystem +final readonly class RequiresOperatingSystem { /** * @psalm-var non-empty-string */ - private readonly string $regularExpression; + private string $regularExpression; /** * @psalm-param non-empty-string $regularExpression diff --git a/src/Framework/Attributes/RequiresOperatingSystemFamily.php b/src/Framework/Attributes/RequiresOperatingSystemFamily.php index d4e2c92b3f1..824d930a70b 100644 --- a/src/Framework/Attributes/RequiresOperatingSystemFamily.php +++ b/src/Framework/Attributes/RequiresOperatingSystemFamily.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class RequiresOperatingSystemFamily +final readonly class RequiresOperatingSystemFamily { /** * @psalm-var non-empty-string */ - private readonly string $operatingSystemFamily; + private string $operatingSystemFamily; /** * @psalm-param non-empty-string $operatingSystemFamily diff --git a/src/Framework/Attributes/RequiresPhp.php b/src/Framework/Attributes/RequiresPhp.php index a6c20b37e7e..01e3a6c2a50 100644 --- a/src/Framework/Attributes/RequiresPhp.php +++ b/src/Framework/Attributes/RequiresPhp.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class RequiresPhp +final readonly class RequiresPhp { /** * @psalm-var non-empty-string */ - private readonly string $versionRequirement; + private string $versionRequirement; /** * @psalm-param non-empty-string $versionRequirement diff --git a/src/Framework/Attributes/RequiresPhpExtension.php b/src/Framework/Attributes/RequiresPhpExtension.php index ab3b57a39b5..01a5d5769ca 100644 --- a/src/Framework/Attributes/RequiresPhpExtension.php +++ b/src/Framework/Attributes/RequiresPhpExtension.php @@ -17,17 +17,17 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class RequiresPhpExtension +final readonly class RequiresPhpExtension { /** * @psalm-var non-empty-string */ - private readonly string $extension; + private string $extension; /** * @psalm-var null|non-empty-string */ - private readonly ?string $versionRequirement; + private ?string $versionRequirement; /** * @psalm-param non-empty-string $extension diff --git a/src/Framework/Attributes/RequiresPhpunit.php b/src/Framework/Attributes/RequiresPhpunit.php index 908e400b948..91eccf727e2 100644 --- a/src/Framework/Attributes/RequiresPhpunit.php +++ b/src/Framework/Attributes/RequiresPhpunit.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class RequiresPhpunit +final readonly class RequiresPhpunit { /** * @psalm-var non-empty-string */ - private readonly string $versionRequirement; + private string $versionRequirement; /** * @psalm-param non-empty-string $versionRequirement diff --git a/src/Framework/Attributes/RequiresSetting.php b/src/Framework/Attributes/RequiresSetting.php index cb7127ab837..cc5f0c6b095 100644 --- a/src/Framework/Attributes/RequiresSetting.php +++ b/src/Framework/Attributes/RequiresSetting.php @@ -17,17 +17,17 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class RequiresSetting +final readonly class RequiresSetting { /** * @psalm-var non-empty-string */ - private readonly string $setting; + private string $setting; /** * @psalm-var non-empty-string */ - private readonly string $value; + private string $value; /** * @psalm-param non-empty-string $setting diff --git a/src/Framework/Attributes/TestDox.php b/src/Framework/Attributes/TestDox.php index f49c4bd5918..6a3576fe6fe 100644 --- a/src/Framework/Attributes/TestDox.php +++ b/src/Framework/Attributes/TestDox.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] -final class TestDox +final readonly class TestDox { /** * @psalm-var non-empty-string */ - private readonly string $text; + private string $text; /** * @psalm-param non-empty-string $text diff --git a/src/Framework/Attributes/TestWith.php b/src/Framework/Attributes/TestWith.php index ed20baa8e8d..a71af7fe335 100644 --- a/src/Framework/Attributes/TestWith.php +++ b/src/Framework/Attributes/TestWith.php @@ -17,9 +17,9 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class TestWith +final readonly class TestWith { - private readonly array $data; + private array $data; public function __construct(array $data) { diff --git a/src/Framework/Attributes/TestWithJson.php b/src/Framework/Attributes/TestWithJson.php index b1cbc3408ba..b23632f715e 100644 --- a/src/Framework/Attributes/TestWithJson.php +++ b/src/Framework/Attributes/TestWithJson.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class TestWithJson +final readonly class TestWithJson { /** * @psalm-var non-empty-string */ - private readonly string $json; + private string $json; /** * @psalm-param non-empty-string $json diff --git a/src/Framework/Attributes/Ticket.php b/src/Framework/Attributes/Ticket.php index c0418e53750..b55f88e52b8 100644 --- a/src/Framework/Attributes/Ticket.php +++ b/src/Framework/Attributes/Ticket.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -final class Ticket +final readonly class Ticket { /** * @psalm-var non-empty-string */ - private readonly string $text; + private string $text; /** * @psalm-param non-empty-string $text diff --git a/src/Framework/Attributes/UsesClass.php b/src/Framework/Attributes/UsesClass.php index 78c64e7bc8e..97135f5384c 100644 --- a/src/Framework/Attributes/UsesClass.php +++ b/src/Framework/Attributes/UsesClass.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] -final class UsesClass +final readonly class UsesClass { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-param class-string $className diff --git a/src/Framework/Attributes/UsesFunction.php b/src/Framework/Attributes/UsesFunction.php index 9e108adb0f4..8df45fd9d13 100644 --- a/src/Framework/Attributes/UsesFunction.php +++ b/src/Framework/Attributes/UsesFunction.php @@ -17,12 +17,12 @@ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] -final class UsesFunction +final readonly class UsesFunction { /** * @psalm-var non-empty-string */ - private readonly string $functionName; + private string $functionName; /** * @psalm-param non-empty-string $functionName diff --git a/src/Framework/Constraint/Equality/IsEqual.php b/src/Framework/Constraint/Equality/IsEqual.php index 2238475d975..4415e36e9fd 100644 --- a/src/Framework/Constraint/Equality/IsEqual.php +++ b/src/Framework/Constraint/Equality/IsEqual.php @@ -24,16 +24,10 @@ final class IsEqual extends Constraint { private readonly mixed $value; - private readonly float $delta; - private readonly bool $canonicalize; - private readonly bool $ignoreCase; - public function __construct(mixed $value, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) + public function __construct(mixed $value) { - $this->value = $value; - $this->delta = $delta; - $this->canonicalize = $canonicalize; - $this->ignoreCase = $ignoreCase; + $this->value = $value; } /** @@ -68,9 +62,6 @@ public function evaluate(mixed $other, string $description = '', bool $returnRes $comparator->assertEquals( $this->value, $other, - $this->delta, - $this->canonicalize, - $this->ignoreCase, ); } catch (ComparisonFailure $f) { if ($returnResult) { @@ -104,13 +95,6 @@ public function toString(bool $exportObjects = false): string ); } - if ($this->delta != 0) { - $delta = sprintf( - ' with delta <%F>', - $this->delta, - ); - } - return sprintf( 'is equal to %s%s', Exporter::export($this->value, $exportObjects), diff --git a/src/Framework/MockObject/ConfigurableMethod.php b/src/Framework/MockObject/ConfigurableMethod.php index d517ffde4c7..ff1788a045c 100644 --- a/src/Framework/MockObject/ConfigurableMethod.php +++ b/src/Framework/MockObject/ConfigurableMethod.php @@ -14,21 +14,35 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ConfigurableMethod +final readonly class ConfigurableMethod { /** * @psalm-var non-empty-string */ - private readonly string $name; - private readonly Type $returnType; + private string $name; + + /** + * @psalm-var array + */ + private array $defaultParameterValues; + + /** + * @psalm-var non-negative-int + */ + private int $numberOfParameters; + private Type $returnType; /** * @psalm-param non-empty-string $name + * @psalm-param array $defaultParameterValues + * @psalm-param non-negative-int $numberOfParameters */ - public function __construct(string $name, Type $returnType) + public function __construct(string $name, array $defaultParameterValues, int $numberOfParameters, Type $returnType) { - $this->name = $name; - $this->returnType = $returnType; + $this->name = $name; + $this->defaultParameterValues = $defaultParameterValues; + $this->numberOfParameters = $numberOfParameters; + $this->returnType = $returnType; } /** @@ -39,6 +53,22 @@ public function name(): string return $this->name; } + /** + * @psalm-return array + */ + public function defaultParameterValues(): array + { + return $this->defaultParameterValues; + } + + /** + * @psalm-return non-negative-int + */ + public function numberOfParameters(): int + { + return $this->numberOfParameters; + } + public function mayReturn(mixed $value): bool { return $this->returnType->isAssignable(Type::fromValue($value, false)); diff --git a/src/Framework/MockObject/Exception/NeverReturningMethodException.php b/src/Framework/MockObject/Exception/NeverReturningMethodException.php new file mode 100644 index 00000000000..21aa6982c89 --- /dev/null +++ b/src/Framework/MockObject/Exception/NeverReturningMethodException.php @@ -0,0 +1,34 @@ + + * + * 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; +use RuntimeException; + +/** + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +final class NeverReturningMethodException extends RuntimeException implements Exception +{ + /** + * @psalm-param class-string $className + * @psalm-param non-empty-string $methodName + */ + public function __construct(string $className, string $methodName) + { + parent::__construct( + sprintf( + 'Method %s::%s() is declared to never return', + $className, + $methodName, + ), + ); + } +} diff --git a/src/Framework/MockObject/Generator/Generator.php b/src/Framework/MockObject/Generator/Generator.php index 45d8460a4fd..0cc671c25f8 100644 --- a/src/Framework/MockObject/Generator/Generator.php +++ b/src/Framework/MockObject/Generator/Generator.php @@ -43,9 +43,14 @@ use Exception; use Iterator; use IteratorAggregate; +use PHPUnit\Event\Code\NoTestCaseObjectOnCallStackException; +use PHPUnit\Event\Code\TestMethodBuilder; +use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Framework\InvalidArgumentException; use PHPUnit\Framework\MockObject\ConfigurableMethod; use PHPUnit\Framework\MockObject\DoubledCloneMethod; +use PHPUnit\Framework\MockObject\GeneratedAsMockObject; +use PHPUnit\Framework\MockObject\GeneratedAsTestStub; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObjectApi; @@ -103,7 +108,7 @@ final class Generator * @throws RuntimeException * @throws UnknownTypeException */ - public function testDouble(string $type, bool $mockObject, ?array $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false, object $proxyTarget = null, bool $allowMockingUnknownTypes = true, bool $returnValueGeneration = true): MockObject|Stub + public function testDouble(string $type, bool $mockObject, bool $markAsMockObject, ?array $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false, object $proxyTarget = null, bool $allowMockingUnknownTypes = true, bool $returnValueGeneration = true): MockObject|Stub { if ($type === Traversable::class) { $type = Iterator::class; @@ -123,6 +128,7 @@ public function testDouble(string $type, bool $mockObject, ?array $methods = [], $mock = $this->generate( $type, $mockObject, + $markAsMockObject, $methods, $mockClassName, $callOriginalClone, @@ -210,7 +216,7 @@ public function testDoubleForInterfaceIntersection(array $interfaces, bool $mock eval($template->render()); - return $this->testDouble($intersectionName, $mockObject); + return $this->testDouble($intersectionName, $mockObject, $mockObject); } /** @@ -254,6 +260,7 @@ interface_exists($originalClassName, $callAutoload)) { $mockObject = $this->testDouble( $originalClassName, true, + true, $methods, $arguments, $mockClassName, @@ -378,12 +385,13 @@ public function objectForTrait(string $traitName, string $traitClassName = '', b * * @see https://github.com/sebastianbergmann/phpunit/issues/5476 */ - public function generate(string $type, bool $mockObject, array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass + public function generate(string $type, bool $mockObject, bool $markAsMockObject, array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass { if ($mockClassName !== '') { return $this->generateCodeForTestDoubleClass( $type, $mockObject, + $markAsMockObject, $methods, $mockClassName, $callOriginalClone, @@ -396,6 +404,7 @@ public function generate(string $type, bool $mockObject, array $methods = null, $key = md5( $type . ($mockObject ? 'MockObject' : 'TestStub') . + ($markAsMockObject ? 'MockObject' : 'TestStub') . serialize($methods) . serialize($callOriginalClone) . serialize($cloneArguments) . @@ -406,6 +415,7 @@ public function generate(string $type, bool $mockObject, array $methods = null, self::$cache[$key] = $this->generateCodeForTestDoubleClass( $type, $mockObject, + $markAsMockObject, $methods, $mockClassName, $callOriginalClone, @@ -584,7 +594,7 @@ private function getObject(MockType $mockClass, string $type = '', bool $callOri * @throws ReflectionException * @throws RuntimeException */ - private function generateCodeForTestDoubleClass(string $type, bool $mockObject, ?array $explicitMethods, string $mockClassName, bool $callOriginalClone, bool $callAutoload, bool $cloneArguments, bool $callOriginalMethods): MockClass + private function generateCodeForTestDoubleClass(string $type, bool $mockObject, bool $markAsMockObject, ?array $explicitMethods, string $mockClassName, bool $callOriginalClone, bool $callAutoload, bool $cloneArguments, bool $callOriginalMethods): MockClass { $classTemplate = $this->loadTemplate('test_double_class.tpl'); $additionalInterfaces = []; @@ -730,7 +740,13 @@ private function generateCodeForTestDoubleClass(string $type, bool $mockObject, foreach ($mockMethods->asArray() as $mockMethod) { $mockedMethods .= $mockMethod->generateCode(); - $configurable[] = new ConfigurableMethod($mockMethod->methodName(), $mockMethod->returnType()); + + $configurable[] = new ConfigurableMethod( + $mockMethod->methodName(), + $mockMethod->defaultParameterValues(), + $mockMethod->numberOfParameters(), + $mockMethod->returnType(), + ); } /** @psalm-var trait-string[] $traits */ @@ -740,6 +756,25 @@ private function generateCodeForTestDoubleClass(string $type, bool $mockObject, $traits[] = MockObjectApi::class; } + if ($markAsMockObject) { + $traits[] = GeneratedAsMockObject::class; + } else { + $traits[] = GeneratedAsTestStub::class; + } + + if ($mockMethods->hasMethod('method') || (isset($class) && $class->hasMethod('method'))) { + $message = 'Doubling interfaces (or classes) that have a method named "method" is deprecated. Support for this will be removed in PHPUnit 12.'; + + try { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + TestMethodBuilder::fromCallStack(), + $message, + ); + } catch (NoTestCaseObjectOnCallStackException) { + EventFacade::emitter()->testRunnerTriggeredDeprecation($message); + } + } + if (!$mockMethods->hasMethod('method') && (!isset($class) || !$class->hasMethod('method'))) { $traits[] = Method::class; } diff --git a/src/Framework/MockObject/Generator/MockClass.php b/src/Framework/MockObject/Generator/MockClass.php index 7606ea5953f..99bfe3ca749 100644 --- a/src/Framework/MockObject/Generator/MockClass.php +++ b/src/Framework/MockObject/Generator/MockClass.php @@ -16,19 +16,19 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class MockClass implements MockType +final readonly class MockClass implements MockType { - private readonly string $classCode; + private string $classCode; /** * @psalm-var class-string */ - private readonly string $mockName; + private string $mockName; /** * @psalm-var list */ - private readonly array $configurableMethods; + private array $configurableMethods; /** * @psalm-param class-string $mockName diff --git a/src/Framework/MockObject/Generator/MockMethod.php b/src/Framework/MockObject/Generator/MockMethod.php index e6955e51bba..4c58e8c6eea 100644 --- a/src/Framework/MockObject/Generator/MockMethod.php +++ b/src/Framework/MockObject/Generator/MockMethod.php @@ -9,6 +9,7 @@ */ namespace PHPUnit\Framework\MockObject\Generator; +use function count; use function explode; use function implode; use function is_object; @@ -54,6 +55,16 @@ final class MockMethod private readonly bool $static; private readonly ?string $deprecation; + /** + * @psalm-var array + */ + private readonly array $defaultParameterValues; + + /** + * @psalm-var non-negative-int + */ + private readonly int $numberOfParameters; + /** * @throws ReflectionException * @throws RuntimeException @@ -94,6 +105,8 @@ public static function fromReflection(ReflectionMethod $method, bool $callOrigin $modifier, self::methodParametersForDeclaration($method), self::methodParametersForCall($method), + self::methodParametersDefaultValues($method), + count($method->getParameters()), (new ReflectionMapper)->fromReturnType($method), $reference, $callOriginalMethod, @@ -115,6 +128,8 @@ public static function fromName(string $className, string $methodName, bool $clo 'public', '', '', + [], + 0, new UnknownType, '', false, @@ -124,10 +139,12 @@ public static function fromName(string $className, string $methodName, bool $clo } /** - * @param class-string $className - * @param non-empty-string $methodName + * @psalm-param class-string $className + * @psalm-param non-empty-string $methodName + * @psalm-param array $defaultParameterValues + * @psalm-param non-negative-int $numberOfParameters */ - private function __construct(string $className, string $methodName, bool $cloneArguments, string $modifier, string $argumentsForDeclaration, string $argumentsForCall, Type $returnType, string $reference, bool $callOriginalMethod, bool $static, ?string $deprecation) + private function __construct(string $className, string $methodName, bool $cloneArguments, string $modifier, string $argumentsForDeclaration, string $argumentsForCall, array $defaultParameterValues, int $numberOfParameters, Type $returnType, string $reference, bool $callOriginalMethod, bool $static, ?string $deprecation) { $this->className = $className; $this->methodName = $methodName; @@ -135,6 +152,8 @@ private function __construct(string $className, string $methodName, bool $cloneA $this->modifier = $modifier; $this->argumentsForDeclaration = $argumentsForDeclaration; $this->argumentsForCall = $argumentsForCall; + $this->defaultParameterValues = $defaultParameterValues; + $this->numberOfParameters = $numberOfParameters; $this->returnType = $returnType; $this->reference = $reference; $this->callOriginalMethod = $callOriginalMethod; @@ -215,6 +234,22 @@ public function returnType(): Type return $this->returnType; } + /** + * @psalm-return array + */ + public function defaultParameterValues(): array + { + return $this->defaultParameterValues; + } + + /** + * @psalm-return non-negative-int + */ + public function numberOfParameters(): int + { + return $this->numberOfParameters; + } + /** * Returns the parameters of a function or method. * @@ -329,4 +364,22 @@ private static function exportDefaultValue(ReflectionParameter $parameter): stri } // @codeCoverageIgnoreEnd } + + /** + * @psalm-return array + */ + private static function methodParametersDefaultValues(ReflectionMethod $method): array + { + $result = []; + + foreach ($method->getParameters() as $i => $parameter) { + if (!$parameter->isDefaultValueAvailable()) { + continue; + } + + $result[$i] = $parameter->getDefaultValue(); + } + + return $result; + } } diff --git a/src/Framework/MockObject/Generator/MockTrait.php b/src/Framework/MockObject/Generator/MockTrait.php index 20e9301b602..dc77ca134b6 100644 --- a/src/Framework/MockObject/Generator/MockTrait.php +++ b/src/Framework/MockObject/Generator/MockTrait.php @@ -16,14 +16,14 @@ * * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5243 */ -final class MockTrait implements MockType +final readonly class MockTrait implements MockType { - private readonly string $classCode; + private string $classCode; /** * @psalm-var class-string */ - private readonly string $mockName; + private string $mockName; /** * @psalm-param class-string $mockName diff --git a/src/Framework/MockObject/MockBuilder.php b/src/Framework/MockObject/MockBuilder.php index e5e78c86fe1..1e4ab368a82 100644 --- a/src/Framework/MockObject/MockBuilder.php +++ b/src/Framework/MockObject/MockBuilder.php @@ -11,7 +11,9 @@ use function array_merge; use function assert; +use function debug_backtrace; use function trait_exists; +use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Framework\InvalidArgumentException; use PHPUnit\Framework\MockObject\Generator\ClassAlreadyExistsException; use PHPUnit\Framework\MockObject\Generator\ClassIsEnumerationException; @@ -94,6 +96,7 @@ public function getMock(): MockObject $object = $this->generator->testDouble( $this->type, true, + true, !$this->emptyMethodsArray ? $this->methods : null, $this->constructorArgs, $this->mockClassName ?? '', @@ -128,6 +131,11 @@ public function getMock(): MockObject */ public function getMockForAbstractClass(): MockObject { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::getMockForAbstractClass() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $object = $this->generator->mockObjectForAbstractClass( $this->type, $this->constructorArgs, @@ -159,6 +167,11 @@ public function getMockForAbstractClass(): MockObject */ public function getMockForTrait(): MockObject { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::getMockForTrait() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + assert(trait_exists($this->type)); $object = $this->generator->mockObjectForTrait( @@ -235,6 +248,11 @@ public function onlyMethods(array $methods): self */ public function addMethods(array $methods): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::addMethods() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + if (empty($methods)) { $this->emptyMethodsArray = true; @@ -347,6 +365,11 @@ public function enableOriginalClone(): self */ public function disableAutoload(): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::disableAutoload() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $this->autoload = false; return $this; @@ -361,6 +384,11 @@ public function disableAutoload(): self */ public function enableAutoload(): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::enableAutoload() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $this->autoload = true; return $this; @@ -375,6 +403,13 @@ public function enableAutoload(): self */ public function disableArgumentCloning(): self { + if (!$this->calledFromTestCase()) { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::disableArgumentCloning() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + } + $this->cloneArguments = false; return $this; @@ -389,6 +424,11 @@ public function disableArgumentCloning(): self */ public function enableArgumentCloning(): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::enableArgumentCloning() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $this->cloneArguments = true; return $this; @@ -403,6 +443,13 @@ public function enableArgumentCloning(): self */ public function enableProxyingToOriginalMethods(): self { + if (!$this->calledFromTestCase()) { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::enableProxyingToOriginalMethods() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + } + $this->callOriginalMethods = true; return $this; @@ -417,6 +464,11 @@ public function enableProxyingToOriginalMethods(): self */ public function disableProxyingToOriginalMethods(): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::disableProxyingToOriginalMethods() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $this->callOriginalMethods = false; $this->proxyTarget = null; @@ -432,6 +484,11 @@ public function disableProxyingToOriginalMethods(): self */ public function setProxyTarget(object $object): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::setProxyTarget() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $this->proxyTarget = $object; return $this; @@ -444,6 +501,11 @@ public function setProxyTarget(object $object): self */ public function allowMockingUnknownTypes(): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::allowMockingUnknownTypes() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $this->allowMockingUnknownTypes = true; return $this; @@ -456,6 +518,13 @@ public function allowMockingUnknownTypes(): self */ public function disallowMockingUnknownTypes(): self { + if (!$this->calledFromTestCase()) { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::disallowMockingUnknownTypes() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + } + $this->allowMockingUnknownTypes = false; return $this; @@ -468,6 +537,11 @@ public function disallowMockingUnknownTypes(): self */ public function enableAutoReturnValueGeneration(): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::enableAutoReturnValueGeneration() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $this->returnValueGeneration = true; return $this; @@ -480,8 +554,20 @@ public function enableAutoReturnValueGeneration(): self */ public function disableAutoReturnValueGeneration(): self { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $this->testCase->valueObjectForEvents(), + 'MockBuilder::disableAutoReturnValueGeneration() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $this->returnValueGeneration = false; return $this; } + + private function calledFromTestCase(): bool + { + $caller = debug_backtrace(limit: 3)[2]; + + return isset($caller['class']) && $caller['class'] === TestCase::class; + } } diff --git a/tests/end-to-end/code-coverage/ignore-method-using-attribute/src/CoveredClass.php b/src/Framework/MockObject/Runtime/Api/GeneratedAsMockObject.php similarity index 56% rename from tests/end-to-end/code-coverage/ignore-method-using-attribute/src/CoveredClass.php rename to src/Framework/MockObject/Runtime/Api/GeneratedAsMockObject.php index e7007383074..66ed17679cd 100644 --- a/tests/end-to-end/code-coverage/ignore-method-using-attribute/src/CoveredClass.php +++ b/src/Framework/MockObject/Runtime/Api/GeneratedAsMockObject.php @@ -7,16 +7,14 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\TestFixture\IgnoreMethodUsingAttribute; +namespace PHPUnit\Framework\MockObject; -final class CoveredClass +/** + * @internal This trait is not covered by the backward compatibility promise for PHPUnit + */ +trait GeneratedAsMockObject { - public function m(): bool - { - return $this->n(); - } - - private function n(): bool + public function __phpunit_wasGeneratedAsMockObject(): true { return true; } diff --git a/src/Framework/MockObject/Runtime/Api/GeneratedAsTestStub.php b/src/Framework/MockObject/Runtime/Api/GeneratedAsTestStub.php new file mode 100644 index 00000000000..9009bece743 --- /dev/null +++ b/src/Framework/MockObject/Runtime/Api/GeneratedAsTestStub.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +/** + * @internal This trait is not covered by the backward compatibility promise for PHPUnit + */ +trait GeneratedAsTestStub +{ + public function __phpunit_wasGeneratedAsMockObject(): false + { + return false; + } +} diff --git a/src/Framework/MockObject/Runtime/Api/Method.php b/src/Framework/MockObject/Runtime/Api/Method.php index a991eae4acd..2112fb3edbb 100644 --- a/src/Framework/MockObject/Runtime/Api/Method.php +++ b/src/Framework/MockObject/Runtime/Api/Method.php @@ -21,7 +21,7 @@ trait Method { public function method(): InvocationMocker { - $expects = $this->expects(new AnyInvokedCount); + $expects = $this->__phpunit_getInvocationHandler()->expects(new AnyInvokedCount); return call_user_func_array( [$expects, 'method'], diff --git a/src/Framework/MockObject/Runtime/Api/MockObjectApi.php b/src/Framework/MockObject/Runtime/Api/MockObjectApi.php index b6b3bd52518..92121546698 100644 --- a/src/Framework/MockObject/Runtime/Api/MockObjectApi.php +++ b/src/Framework/MockObject/Runtime/Api/MockObjectApi.php @@ -9,6 +9,10 @@ */ namespace PHPUnit\Framework\MockObject; +use function assert; +use PHPUnit\Event\Code\NoTestCaseObjectOnCallStackException; +use PHPUnit\Event\Code\TestMethodBuilder; +use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Framework\MockObject\Builder\InvocationMocker as InvocationMockerBuilder; use PHPUnit\Framework\MockObject\Rule\InvocationOrder; @@ -17,6 +21,7 @@ */ trait MockObjectApi { + private static array $__phpunit_deprecation_emitted_for_test = []; private object $__phpunit_originalObject; /** @noinspection MagicMethodsValidityInspection */ @@ -47,6 +52,27 @@ abstract public function __phpunit_unsetInvocationMocker(): void; public function expects(InvocationOrder $matcher): InvocationMockerBuilder { + assert($this instanceof StubInternal); + + if (!$this->__phpunit_wasGeneratedAsMockObject()) { + $message = 'Configuring expectations on test doubles that were created as test stubs is deprecated. Support for this will be removed in PHPUnit 12.'; + + try { + $test = TestMethodBuilder::fromCallStack(); + + if (!isset(self::$__phpunit_deprecation_emitted_for_test[$test->id()])) { + EventFacade::emitter()->testTriggeredPhpunitDeprecation( + $test, + $message, + ); + + self::$__phpunit_deprecation_emitted_for_test[$test->id()] = true; + } + } catch (NoTestCaseObjectOnCallStackException) { + EventFacade::emitter()->testRunnerTriggeredDeprecation($message); + } + } + return $this->__phpunit_getInvocationHandler()->expects($matcher); } } diff --git a/src/Framework/MockObject/Runtime/Builder/InvocationMocker.php b/src/Framework/MockObject/Runtime/Builder/InvocationMocker.php index f7d1d16863e..fbff6cbdac8 100644 --- a/src/Framework/MockObject/Runtime/Builder/InvocationMocker.php +++ b/src/Framework/MockObject/Runtime/Builder/InvocationMocker.php @@ -13,8 +13,11 @@ use function array_key_exists; use function array_map; use function array_merge; +use function array_pop; +use function assert; use function count; use function is_string; +use function range; use function strtolower; use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\InvalidArgumentException; @@ -117,7 +120,45 @@ public function willReturnReference(mixed &$reference): self public function willReturnMap(array $valueMap): self { - $stub = new ReturnValueMap($valueMap); + $method = $this->configuredMethod(); + + assert($method instanceof ConfigurableMethod); + + $numberOfParameters = $method->numberOfParameters(); + $defaultValues = $method->defaultParameterValues(); + $hasDefaultValues = !empty($defaultValues); + + $_valueMap = []; + + foreach ($valueMap as $mapping) { + $numberOfConfiguredParameters = count($mapping) - 1; + + if ($numberOfConfiguredParameters === $numberOfParameters || !$hasDefaultValues) { + $_valueMap[] = $mapping; + + continue; + } + + $_mapping = []; + $returnValue = array_pop($mapping); + + foreach (range(0, $numberOfParameters - 1) as $i) { + if (isset($mapping[$i])) { + $_mapping[] = $mapping[$i]; + + continue; + } + + if (isset($defaultValues[$i])) { + $_mapping[] = $defaultValues[$i]; + } + } + + $_mapping[] = $returnValue; + $_valueMap[] = $_mapping; + } + + $stub = new ReturnValueMap($_valueMap); return $this->will($stub); } diff --git a/src/Framework/MockObject/Runtime/Interface/StubInternal.php b/src/Framework/MockObject/Runtime/Interface/StubInternal.php index 79cc6a27970..10445265ada 100644 --- a/src/Framework/MockObject/Runtime/Interface/StubInternal.php +++ b/src/Framework/MockObject/Runtime/Interface/StubInternal.php @@ -21,4 +21,6 @@ public function __phpunit_getInvocationHandler(): InvocationHandler; public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration): void; public function __phpunit_unsetInvocationMocker(): void; + + public function __phpunit_wasGeneratedAsMockObject(): bool; } diff --git a/src/Framework/MockObject/Runtime/Invocation.php b/src/Framework/MockObject/Runtime/Invocation.php index d92ea1b3834..f99ae28937b 100644 --- a/src/Framework/MockObject/Runtime/Invocation.php +++ b/src/Framework/MockObject/Runtime/Invocation.php @@ -23,22 +23,22 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class Invocation implements SelfDescribing +final readonly class Invocation implements SelfDescribing { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var non-empty-string */ - private readonly string $methodName; - private readonly array $parameters; - private readonly string $returnType; - private readonly bool $isReturnTypeNullable; - private readonly bool $proxiedCall; - private readonly MockObjectInternal|StubInternal $object; + private string $methodName; + private array $parameters; + private string $returnType; + private bool $isReturnTypeNullable; + private bool $proxiedCall; + private MockObjectInternal|StubInternal $object; /** * @psalm-param class-string $className @@ -105,6 +105,13 @@ public function parameters(): array */ public function generateReturnValue(): mixed { + if ($this->returnType === 'never') { + throw new NeverReturningMethodException( + $this->className, + $this->methodName, + ); + } + if ($this->isReturnTypeNullable || $this->proxiedCall) { return null; } diff --git a/src/Framework/MockObject/Runtime/ReturnValueGenerator.php b/src/Framework/MockObject/Runtime/ReturnValueGenerator.php index 8338d425fbc..2c2807d30e4 100644 --- a/src/Framework/MockObject/Runtime/ReturnValueGenerator.php +++ b/src/Framework/MockObject/Runtime/ReturnValueGenerator.php @@ -204,7 +204,7 @@ private function newInstanceOf(string $stubClassName, string $className, string private function testDoubleFor(string $type, string $className, string $methodName): Stub { try { - return (new Generator)->testDouble($type, false, [], [], '', false); + return (new Generator)->testDouble($type, false, false, [], [], '', false); } catch (Throwable $t) { throw new RuntimeException( sprintf( diff --git a/src/Framework/MockObject/Runtime/Rule/MethodName.php b/src/Framework/MockObject/Runtime/Rule/MethodName.php index 3c4101286bc..ed4b65a9af2 100644 --- a/src/Framework/MockObject/Runtime/Rule/MethodName.php +++ b/src/Framework/MockObject/Runtime/Rule/MethodName.php @@ -18,9 +18,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class MethodName +final readonly class MethodName { - private readonly Constraint $constraint; + private Constraint $constraint; /** * @throws InvalidArgumentException diff --git a/src/Framework/MockObject/Runtime/Stub/Exception.php b/src/Framework/MockObject/Runtime/Stub/Exception.php index c2b349ca034..04bd1303802 100644 --- a/src/Framework/MockObject/Runtime/Stub/Exception.php +++ b/src/Framework/MockObject/Runtime/Stub/Exception.php @@ -15,9 +15,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class Exception implements Stub +final readonly class Exception implements Stub { - private readonly Throwable $exception; + private Throwable $exception; public function __construct(Throwable $exception) { diff --git a/src/Framework/MockObject/Runtime/Stub/ReturnArgument.php b/src/Framework/MockObject/Runtime/Stub/ReturnArgument.php index 4b28813c903..5172f64b45d 100644 --- a/src/Framework/MockObject/Runtime/Stub/ReturnArgument.php +++ b/src/Framework/MockObject/Runtime/Stub/ReturnArgument.php @@ -14,9 +14,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ReturnArgument implements Stub +final readonly class ReturnArgument implements Stub { - private readonly int $argumentIndex; + private int $argumentIndex; public function __construct(int $argumentIndex) { diff --git a/src/Framework/MockObject/Runtime/Stub/ReturnStub.php b/src/Framework/MockObject/Runtime/Stub/ReturnStub.php index d810ceba73a..eb888c38dff 100644 --- a/src/Framework/MockObject/Runtime/Stub/ReturnStub.php +++ b/src/Framework/MockObject/Runtime/Stub/ReturnStub.php @@ -14,9 +14,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ReturnStub implements Stub +final readonly class ReturnStub implements Stub { - private readonly mixed $value; + private mixed $value; public function __construct(mixed $value) { diff --git a/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php b/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php index 2cdf1604f55..68db6cb92c0 100644 --- a/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php +++ b/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php @@ -17,9 +17,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ReturnValueMap implements Stub +final readonly class ReturnValueMap implements Stub { - private readonly array $valueMap; + private array $valueMap; public function __construct(array $valueMap) { diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index c03ae295630..e2bc0f4cf38 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -56,7 +56,6 @@ use DeepCopy\DeepCopy; use PHPUnit\Event; use PHPUnit\Event\NoPreviousThrowableException; -use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException; use PHPUnit\Event\TestData\NoDataSetFromDataProviderException; use PHPUnit\Framework\Constraint\Exception as ExceptionConstraint; use PHPUnit\Framework\Constraint\ExceptionCode; @@ -192,128 +191,6 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T */ private array $failureTypes = []; - /** - * Returns a matcher that matches when the method is executed - * zero or more times. - */ - final public static function any(): AnyInvokedCountMatcher - { - return new AnyInvokedCountMatcher; - } - - /** - * Returns a matcher that matches when the method is never executed. - */ - final public static function never(): InvokedCountMatcher - { - return new InvokedCountMatcher(0); - } - - /** - * Returns a matcher that matches when the method is executed - * at least N times. - */ - final public static function atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher - { - return new InvokedAtLeastCountMatcher( - $requiredInvocations, - ); - } - - /** - * Returns a matcher that matches when the method is executed at least once. - */ - final public static function atLeastOnce(): InvokedAtLeastOnceMatcher - { - return new InvokedAtLeastOnceMatcher; - } - - /** - * Returns a matcher that matches when the method is executed exactly once. - */ - final public static function once(): InvokedCountMatcher - { - return new InvokedCountMatcher(1); - } - - /** - * Returns a matcher that matches when the method is executed - * exactly $count times. - */ - final public static function exactly(int $count): InvokedCountMatcher - { - return new InvokedCountMatcher($count); - } - - /** - * Returns a matcher that matches when the method is executed - * at most N times. - */ - final public static function atMost(int $allowedInvocations): InvokedAtMostCountMatcher - { - return new InvokedAtMostCountMatcher($allowedInvocations); - } - - /** - * @deprecated Use $double->willReturn() instead of $double->will($this->returnValue()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final public static function returnValue(mixed $value): ReturnStub - { - return new ReturnStub($value); - } - - /** - * @deprecated Use $double->willReturnMap() instead of $double->will($this->returnValueMap()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final public static function returnValueMap(array $valueMap): ReturnValueMapStub - { - return new ReturnValueMapStub($valueMap); - } - - /** - * @deprecated Use $double->willReturnArgument() instead of $double->will($this->returnArgument()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final public static function returnArgument(int $argumentIndex): ReturnArgumentStub - { - return new ReturnArgumentStub($argumentIndex); - } - - /** - * @deprecated Use $double->willReturnCallback() instead of $double->will($this->returnCallback()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final public static function returnCallback(callable $callback): ReturnCallbackStub - { - return new ReturnCallbackStub($callback); - } - - /** - * @deprecated Use $double->willReturnSelf() instead of $double->will($this->returnSelf()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - */ - final public static function returnSelf(): ReturnSelfStub - { - return new ReturnSelfStub; - } - - final public static function throwException(Throwable $exception): ExceptionStub - { - return new ExceptionStub($exception); - } - - /** - * @deprecated Use $double->willReturn() instead of $double->will($this->onConsecutiveCalls()) - * @see https://github.com/sebastianbergmann/phpunit/issues/5423 - * @see https://github.com/sebastianbergmann/phpunit/issues/5425 - */ - final public static function onConsecutiveCalls(mixed ...$arguments): ConsecutiveCallsStub - { - return new ConsecutiveCallsStub($arguments); - } - /** * @psalm-param non-empty-string $name * @@ -398,63 +275,6 @@ final public function count(): int return 1; } - final public function getActualOutputForAssertion(): string - { - $this->outputRetrievedForAssertion = true; - - return $this->output(); - } - - final public function expectOutputRegex(string $expectedRegex): void - { - $this->outputExpectedRegex = $expectedRegex; - } - - final public function expectOutputString(string $expectedString): void - { - $this->outputExpectedString = $expectedString; - } - - /** - * @psalm-param class-string $exception - */ - final public function expectException(string $exception): void - { - $this->expectedException = $exception; - } - - final public function expectExceptionCode(int|string $code): void - { - $this->expectedExceptionCode = $code; - } - - final public function expectExceptionMessage(string $message): void - { - $this->expectedExceptionMessage = $message; - } - - final public function expectExceptionMessageMatches(string $regularExpression): void - { - $this->expectedExceptionMessageRegExp = $regularExpression; - } - - /** - * Sets up an expectation for an exception to be raised by the code under test. - * Information for expected exception class, expected exception message, and - * expected exception code are retrieved from a given Exception object. - */ - final public function expectExceptionObject(\Exception $exception): void - { - $this->expectException($exception::class); - $this->expectExceptionMessage($exception->getMessage()); - $this->expectExceptionCode($exception->getCode()); - } - - final public function expectNotToPerformAssertions(): void - { - $this->doesNotPerformAssertions = true; - } - /** * @internal This method is not covered by the backward compatibility promise for PHPUnit */ @@ -470,7 +290,6 @@ final public function status(): TestStatus * @throws \SebastianBergmann\Template\InvalidArgumentException * @throws CodeCoverageException * @throws Exception - * @throws MoreThanOneDataSetFromDataProviderException * @throws NoDataSetFromDataProviderException * @throws NoPreviousThrowableException * @throws ProcessIsolationException @@ -496,20 +315,6 @@ final public function run(): void } } - /** - * Returns a builder object to create mock objects using a fluent interface. - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $className - * - * @psalm-return MockBuilder - */ - final public function getMockBuilder(string $className): MockBuilder - { - return new MockBuilder($this, $className); - } - /** * @internal This method is not covered by the backward compatibility promise for PHPUnit */ @@ -1057,8 +862,6 @@ final public function setData(int|string $dataName, array $data): void /** * @internal This method is not covered by the backward compatibility promise for PHPUnit - * - * @throws MoreThanOneDataSetFromDataProviderException */ final public function valueObjectForEvents(): Event\Code\TestMethod { @@ -1079,6 +882,229 @@ final public function wasPrepared(): bool return $this->wasPrepared; } + /** + * Returns a matcher that matches when the method is executed + * zero or more times. + */ + final protected function any(): AnyInvokedCountMatcher + { + return new AnyInvokedCountMatcher; + } + + /** + * Returns a matcher that matches when the method is never executed. + */ + final protected function never(): InvokedCountMatcher + { + return new InvokedCountMatcher(0); + } + + /** + * Returns a matcher that matches when the method is executed + * at least N times. + */ + final protected function atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher + { + return new InvokedAtLeastCountMatcher( + $requiredInvocations, + ); + } + + /** + * Returns a matcher that matches when the method is executed at least once. + */ + final protected function atLeastOnce(): InvokedAtLeastOnceMatcher + { + return new InvokedAtLeastOnceMatcher; + } + + /** + * Returns a matcher that matches when the method is executed exactly once. + */ + final protected function once(): InvokedCountMatcher + { + return new InvokedCountMatcher(1); + } + + /** + * Returns a matcher that matches when the method is executed + * exactly $count times. + */ + final protected function exactly(int $count): InvokedCountMatcher + { + return new InvokedCountMatcher($count); + } + + /** + * Returns a matcher that matches when the method is executed + * at most N times. + */ + final protected function atMost(int $allowedInvocations): InvokedAtMostCountMatcher + { + return new InvokedAtMostCountMatcher($allowedInvocations); + } + + /** + * @deprecated Use $double->willReturn() instead of $double->will($this->returnValue()) + * @see https://github.com/sebastianbergmann/phpunit/issues/5423 + */ + final protected function returnValue(mixed $value): ReturnStub + { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'returnValue() is deprecated and will be removed in PHPUnit 12. Use $double->willReturn() instead of $double->will($this->returnValue())', + ); + + return new ReturnStub($value); + } + + /** + * @deprecated Use $double->willReturnMap() instead of $double->will($this->returnValueMap()) + * @see https://github.com/sebastianbergmann/phpunit/issues/5423 + */ + final protected function returnValueMap(array $valueMap): ReturnValueMapStub + { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'returnValueMap() is deprecated and will be removed in PHPUnit 12. Use $double->willReturnMap() instead of $double->will($this->returnValueMap())', + ); + + return new ReturnValueMapStub($valueMap); + } + + /** + * @deprecated Use $double->willReturnArgument() instead of $double->will($this->returnArgument()) + * @see https://github.com/sebastianbergmann/phpunit/issues/5423 + */ + final protected function returnArgument(int $argumentIndex): ReturnArgumentStub + { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'returnArgument() is deprecated and will be removed in PHPUnit 12. Use $double->willReturnArgument() instead of $double->will($this->returnArgument())', + ); + + return new ReturnArgumentStub($argumentIndex); + } + + /** + * @deprecated Use $double->willReturnCallback() instead of $double->will($this->returnCallback()) + * @see https://github.com/sebastianbergmann/phpunit/issues/5423 + */ + final protected function returnCallback(callable $callback): ReturnCallbackStub + { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'returnCallback() is deprecated and will be removed in PHPUnit 12. Use $double->willReturnCallback() instead of $double->will($this->returnCallback())', + ); + + return new ReturnCallbackStub($callback); + } + + /** + * @deprecated Use $double->willReturnSelf() instead of $double->will($this->returnSelf()) + * @see https://github.com/sebastianbergmann/phpunit/issues/5423 + */ + final protected function returnSelf(): ReturnSelfStub + { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'returnSelf() is deprecated and will be removed in PHPUnit 12. Use $double->willReturnSelf() instead of $double->will($this->returnSelf())', + ); + + return new ReturnSelfStub; + } + + final protected function throwException(Throwable $exception): ExceptionStub + { + return new ExceptionStub($exception); + } + + /** + * @deprecated Use $double->willReturn() instead of $double->will($this->onConsecutiveCalls()) + * @see https://github.com/sebastianbergmann/phpunit/issues/5423 + * @see https://github.com/sebastianbergmann/phpunit/issues/5425 + */ + final protected function onConsecutiveCalls(mixed ...$arguments): ConsecutiveCallsStub + { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'onConsecutiveCalls() is deprecated and will be removed in PHPUnit 12. Use $double->willReturn() instead of $double->will($this->onConsecutiveCalls())', + ); + + return new ConsecutiveCallsStub($arguments); + } + + final protected function getActualOutputForAssertion(): string + { + $this->outputRetrievedForAssertion = true; + + return $this->output(); + } + + final protected function expectOutputRegex(string $expectedRegex): void + { + $this->outputExpectedRegex = $expectedRegex; + } + + final protected function expectOutputString(string $expectedString): void + { + $this->outputExpectedString = $expectedString; + } + + /** + * @psalm-param class-string $exception + */ + final protected function expectException(string $exception): void + { + $this->expectedException = $exception; + } + + final protected function expectExceptionCode(int|string $code): void + { + $this->expectedExceptionCode = $code; + } + + final protected function expectExceptionMessage(string $message): void + { + $this->expectedExceptionMessage = $message; + } + + final protected function expectExceptionMessageMatches(string $regularExpression): void + { + $this->expectedExceptionMessageRegExp = $regularExpression; + } + + /** + * Sets up an expectation for an exception to be raised by the code under test. + * Information for expected exception class, expected exception message, and + * expected exception code are retrieved from a given Exception object. + */ + final protected function expectExceptionObject(\Exception $exception): void + { + $this->expectException($exception::class); + $this->expectExceptionMessage($exception->getMessage()); + $this->expectExceptionCode($exception->getCode()); + } + + final protected function expectNotToPerformAssertions(): void + { + $this->doesNotPerformAssertions = true; + } + + /** + * Returns a builder object to create mock objects using a fluent interface. + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $className + * + * @psalm-return MockBuilder + */ + final protected function getMockBuilder(string $className): MockBuilder + { + return new MockBuilder($this, $className); + } + final protected function registerComparator(Comparator $comparator): void { ComparatorFactory::getInstance()->register($comparator); @@ -1104,7 +1130,7 @@ final protected function registerFailureType(string $classOrInterface): void * * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - protected function runTest(): mixed + final protected function runTest(): mixed { $testArguments = array_merge($this->data, $this->dependencyInput); @@ -1136,8 +1162,13 @@ protected function runTest(): mixed * * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5214 */ - protected function iniSet(string $varName, string $newValue): void + final protected function iniSet(string $varName, string $newValue): void { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'iniSet() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $currentValue = ini_set($varName, $newValue); if ($currentValue !== false) { @@ -1161,8 +1192,13 @@ protected function iniSet(string $varName, string $newValue): void * * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5216 */ - protected function setLocale(mixed ...$arguments): void + final protected function setLocale(mixed ...$arguments): void { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'setLocale() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + if (count($arguments) < 2) { throw new Exception; } @@ -1203,11 +1239,12 @@ protected function setLocale(mixed ...$arguments): void * @throws InvalidArgumentException * @throws NoPreviousThrowableException */ - protected function createMock(string $originalClassName): MockObject + final protected function createMock(string $originalClassName): MockObject { $mock = (new MockGenerator)->testDouble( $originalClassName, true, + true, callOriginalConstructor: false, callOriginalClone: false, cloneArguments: false, @@ -1229,7 +1266,7 @@ protected function createMock(string $originalClassName): MockObject * * @throws \PHPUnit\Framework\MockObject\Exception */ - protected function createMockForIntersectionOfInterfaces(array $interfaces): MockObject + final protected function createMockForIntersectionOfInterfaces(array $interfaces): MockObject { $mock = (new MockGenerator)->testDoubleForInterfaceIntersection($interfaces, true); @@ -1253,7 +1290,7 @@ protected function createMockForIntersectionOfInterfaces(array $interfaces): Moc * @throws InvalidArgumentException * @throws NoPreviousThrowableException */ - protected function createConfiguredMock(string $originalClassName, array $configuration): MockObject + final protected function createConfiguredMock(string $originalClassName, array $configuration): MockObject { $o = $this->createMock($originalClassName); @@ -1278,7 +1315,7 @@ protected function createConfiguredMock(string $originalClassName, array $config * @throws \PHPUnit\Framework\MockObject\Exception * @throws InvalidArgumentException */ - protected function createPartialMock(string $originalClassName, array $methods): MockObject + final protected function createPartialMock(string $originalClassName, array $methods): MockObject { $partialMock = $this->getMockBuilder($originalClassName) ->disableOriginalConstructor() @@ -1310,8 +1347,13 @@ protected function createPartialMock(string $originalClassName, array $methods): * * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5240 */ - protected function createTestProxy(string $originalClassName, array $constructorArguments = []): MockObject + final protected function createTestProxy(string $originalClassName, array $constructorArguments = []): MockObject { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'createTestProxy() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $testProxy = $this->getMockBuilder($originalClassName) ->setConstructorArgs($constructorArguments) ->enableProxyingToOriginalMethods() @@ -1341,8 +1383,13 @@ protected function createTestProxy(string $originalClassName, array $constructor * * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5241 */ - protected function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false): MockObject + final protected function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false): MockObject { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'getMockForAbstractClass() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $mockObject = (new MockGenerator)->mockObjectForAbstractClass( $originalClassName, $arguments, @@ -1371,8 +1418,13 @@ protected function getMockForAbstractClass(string $originalClassName, array $arg * * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5242 */ - protected function getMockFromWsdl(string $wsdlFile, string $originalClassName = '', string $mockClassName = '', array $methods = [], bool $callOriginalConstructor = true, array $options = []): MockObject + final protected function getMockFromWsdl(string $wsdlFile, string $originalClassName = '', string $mockClassName = '', array $methods = [], bool $callOriginalConstructor = true, array $options = []): MockObject { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'getMockFromWsdl() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + if ($originalClassName === '') { $fileName = pathinfo(basename(parse_url($wsdlFile, PHP_URL_PATH)), PATHINFO_FILENAME); $originalClassName = preg_replace('/\W/', '', $fileName); @@ -1392,6 +1444,7 @@ protected function getMockFromWsdl(string $wsdlFile, string $originalClassName = $mockObject = (new MockGenerator)->testDouble( $originalClassName, true, + true, $methods, ['', $options], $mockClassName, @@ -1428,8 +1481,13 @@ protected function getMockFromWsdl(string $wsdlFile, string $originalClassName = * * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5243 */ - protected function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false): MockObject + final protected function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false): MockObject { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'getMockForTrait() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + $mockObject = (new MockGenerator)->mockObjectForTrait( $traitName, $arguments, @@ -1457,8 +1515,13 @@ protected function getMockForTrait(string $traitName, array $arguments = [], str * * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5244 */ - protected function getObjectForTrait(string $traitName, array $arguments = [], string $traitClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true): object + final protected function getObjectForTrait(string $traitName, array $arguments = [], string $traitClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true): object { + Event\Facade::emitter()->testTriggeredPhpunitDeprecation( + $this->valueObjectForEvents(), + 'getObjectForTrait() is deprecated and will be removed in PHPUnit 12. No replacement is/will be provided.', + ); + return (new MockGenerator)->objectForTrait( $traitName, $traitClassName, @@ -1593,7 +1656,6 @@ private function handleDependencies(): bool /** * @throws Exception - * @throws MoreThanOneDataSetFromDataProviderException * @throws NoPreviousThrowableException */ private function markErrorForInvalidDependency(?ExecutionOrderDependency $dependency = null): void @@ -1617,9 +1679,6 @@ private function markErrorForInvalidDependency(?ExecutionOrderDependency $depend $this->status = TestStatus::error($message); } - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ private function markSkippedForMissingDependency(ExecutionOrderDependency $dependency): void { $message = sprintf( @@ -1643,9 +1702,6 @@ private function startOutputBuffering(): void $this->outputBufferingLevel = ob_get_level(); } - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ private function stopOutputBuffering(): bool { $bufferingLevel = ob_get_level(); @@ -1691,9 +1747,6 @@ private function snapshotGlobalState(): void $this->snapshot = $snapshot; } - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ private function restoreGlobalState(): void { if (!$this->snapshot instanceof Snapshot) { @@ -1758,9 +1811,6 @@ private function createGlobalStateSnapshot(bool $backupGlobals): Snapshot ); } - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ private function compareGlobalStateSnapshots(Snapshot $before, Snapshot $after): void { $backupGlobals = $this->backupGlobals === null || $this->backupGlobals; @@ -1788,9 +1838,6 @@ private function compareGlobalStateSnapshots(Snapshot $before, Snapshot $after): } } - /** - * @throws MoreThanOneDataSetFromDataProviderException - */ private function compareGlobalStateSnapshotPart(array $before, array $after, string $header): void { if ($before != $after) { @@ -1961,7 +2008,6 @@ private function isCallableTestMethod(string $dependency): bool /** * @throws Exception * @throws ExpectationFailedException - * @throws MoreThanOneDataSetFromDataProviderException * @throws NoPreviousThrowableException */ private function performAssertionsOnOutput(): void @@ -2235,11 +2281,12 @@ private function hasExpectationOnOutput(): bool * @throws InvalidArgumentException * @throws NoPreviousThrowableException */ - protected static function createStub(string $originalClassName): Stub + final protected static function createStub(string $originalClassName): Stub { $stub = (new MockGenerator)->testDouble( $originalClassName, true, + false, callOriginalConstructor: false, callOriginalClone: false, cloneArguments: false, @@ -2259,7 +2306,7 @@ protected static function createStub(string $originalClassName): Stub * * @throws \PHPUnit\Framework\MockObject\Exception */ - protected static function createStubForIntersectionOfInterfaces(array $interfaces): Stub + final protected static function createStubForIntersectionOfInterfaces(array $interfaces): Stub { $stub = (new MockGenerator)->testDoubleForInterfaceIntersection($interfaces, false); diff --git a/src/Framework/TestRunner.php b/src/Framework/TestRunner.php index e5f5b033bf8..97ad391828d 100644 --- a/src/Framework/TestRunner.php +++ b/src/Framework/TestRunner.php @@ -25,7 +25,6 @@ use AssertionError; use PHPUnit\Event; use PHPUnit\Event\NoPreviousThrowableException; -use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException; use PHPUnit\Event\TestData\NoDataSetFromDataProviderException; use PHPUnit\Metadata\Api\CodeCoverage as CodeCoverageMetadataApi; use PHPUnit\Metadata\Parser\Registry as MetadataRegistry; @@ -61,7 +60,6 @@ public function __construct() * @throws \PHPUnit\Runner\Exception * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException * @throws CodeCoverageException - * @throws MoreThanOneDataSetFromDataProviderException * @throws NoDataSetFromDataProviderException * @throws UnintentionallyCoveredCodeException */ @@ -247,7 +245,6 @@ public function run(TestCase $test): void * @throws \PHPUnit\Util\Exception * @throws \SebastianBergmann\Template\InvalidArgumentException * @throws Exception - * @throws MoreThanOneDataSetFromDataProviderException * @throws NoPreviousThrowableException * @throws ProcessIsolationException * @throws StaticAnalysisCacheNotConfiguredException diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 15a144cfb2f..84cdb6ea4c3 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -463,7 +463,6 @@ public function isForTestClass(): bool } /** - * @throws \PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException * @throws Exception */ protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method): void diff --git a/src/Logging/EventLogger.php b/src/Logging/EventLogger.php index 559fb5ec83f..53ccadbfc63 100644 --- a/src/Logging/EventLogger.php +++ b/src/Logging/EventLogger.php @@ -23,10 +23,10 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class EventLogger implements Tracer +final readonly class EventLogger implements Tracer { - private readonly string $path; - private readonly bool $includeTelemetryInfo; + private string $path; + private bool $includeTelemetryInfo; public function __construct(string $path, bool $includeTelemetryInfo) { diff --git a/src/Logging/TestDox/TestMethod/TestResult.php b/src/Logging/TestDox/TestMethod/TestResult.php index d2108344448..4bde8ee1da6 100644 --- a/src/Logging/TestDox/TestMethod/TestResult.php +++ b/src/Logging/TestDox/TestMethod/TestResult.php @@ -19,17 +19,17 @@ * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class TestResult +final readonly class TestResult { - private readonly TestMethod $test; - private readonly Duration $duration; - private readonly TestStatus $status; - private readonly ?Throwable $throwable; + private TestMethod $test; + private Duration $duration; + private TestStatus $status; + private ?Throwable $throwable; /** * @psalm-var list */ - private readonly array $testDoubles; + private array $testDoubles; /** * @psalm-param list $testDoubles diff --git a/src/Logging/TestDox/TestMethod/TestResultCollection.php b/src/Logging/TestDox/TestMethod/TestResultCollection.php index 98c6f7d5b1f..aedb7d0fec0 100644 --- a/src/Logging/TestDox/TestMethod/TestResultCollection.php +++ b/src/Logging/TestDox/TestMethod/TestResultCollection.php @@ -18,12 +18,12 @@ * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class TestResultCollection implements IteratorAggregate +final readonly class TestResultCollection implements IteratorAggregate { /** * @psalm-var list */ - private readonly array $testResults; + private array $testResults; /** * @psalm-param list $testResults diff --git a/src/Metadata/Api/CodeCoverage.php b/src/Metadata/Api/CodeCoverage.php index b2a1f950bb3..0741aeb1cb9 100644 --- a/src/Metadata/Api/CodeCoverage.php +++ b/src/Metadata/Api/CodeCoverage.php @@ -9,8 +9,6 @@ */ namespace PHPUnit\Metadata\Api; -use function array_unique; -use function array_values; use function assert; use function count; use function interface_exists; @@ -18,20 +16,15 @@ use function str_starts_with; use PHPUnit\Framework\CodeCoverageException; use PHPUnit\Framework\InvalidCoversTargetException; -use PHPUnit\Framework\TestSuite; use PHPUnit\Metadata\Covers; use PHPUnit\Metadata\CoversClass; use PHPUnit\Metadata\CoversDefaultClass; use PHPUnit\Metadata\CoversFunction; -use PHPUnit\Metadata\IgnoreClassForCodeCoverage; -use PHPUnit\Metadata\IgnoreFunctionForCodeCoverage; -use PHPUnit\Metadata\IgnoreMethodForCodeCoverage; use PHPUnit\Metadata\Parser\Registry; use PHPUnit\Metadata\Uses; use PHPUnit\Metadata\UsesClass; use PHPUnit\Metadata\UsesDefaultClass; use PHPUnit\Metadata\UsesFunction; -use RecursiveIteratorIterator; use SebastianBergmann\CodeUnit\CodeUnitCollection; use SebastianBergmann\CodeUnit\InvalidCodeUnitException; use SebastianBergmann\CodeUnit\Mapper; @@ -224,23 +217,6 @@ public function linesToBeUsed(string $className, string $methodName): array return $mapper->codeUnitsToSourceLines($codeUnits); } - /** - * @psalm-return array> - */ - public function linesToBeIgnored(TestSuite $testSuite): array - { - $codeUnits = CodeUnitCollection::fromList(); - $mapper = new Mapper; - - foreach ($this->testCaseClassesIn($testSuite) as $testCaseClassName) { - $codeUnits = $codeUnits->mergeWith( - $this->codeUnitsIgnoredBy($testCaseClassName), - ); - } - - return $mapper->codeUnitsToSourceLines($codeUnits); - } - /** * @psalm-param class-string $className * @psalm-param non-empty-string $methodName @@ -266,49 +242,4 @@ public function shouldCodeCoverageBeCollectedFor(string $className, string $meth return true; } - - /** - * @psalm-return list - */ - private function testCaseClassesIn(TestSuite $testSuite): array - { - $classNames = []; - - foreach (new RecursiveIteratorIterator($testSuite) as $test) { - $classNames[] = $test::class; - } - - return array_values(array_unique($classNames)); - } - - /** - * @psalm-param class-string $className - */ - private function codeUnitsIgnoredBy(string $className): CodeUnitCollection - { - $codeUnits = CodeUnitCollection::fromList(); - $mapper = new Mapper; - - foreach (Registry::parser()->forClass($className) as $metadata) { - if ($metadata instanceof IgnoreClassForCodeCoverage) { - $codeUnits = $codeUnits->mergeWith( - $mapper->stringToCodeUnits($metadata->className()), - ); - } - - if ($metadata instanceof IgnoreMethodForCodeCoverage) { - $codeUnits = $codeUnits->mergeWith( - $mapper->stringToCodeUnits($metadata->className() . '::' . $metadata->methodName()), - ); - } - - if ($metadata instanceof IgnoreFunctionForCodeCoverage) { - $codeUnits = $codeUnits->mergeWith( - $mapper->stringToCodeUnits('::' . $metadata->functionName()), - ); - } - } - - return $codeUnits; - } } diff --git a/src/Metadata/Api/DataProvider.php b/src/Metadata/Api/DataProvider.php index 2399a83869c..db8d00ce9a0 100644 --- a/src/Metadata/Api/DataProvider.php +++ b/src/Metadata/Api/DataProvider.php @@ -27,15 +27,11 @@ use function substr; use function trim; use PHPUnit\Event; -use PHPUnit\Event\Code\TestMethod; -use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException; -use PHPUnit\Event\TestData\TestDataCollection; use PHPUnit\Framework\InvalidDataProviderException; use PHPUnit\Metadata\DataProvider as DataProviderMetadata; use PHPUnit\Metadata\MetadataCollection; use PHPUnit\Metadata\Parser\Registry as MetadataRegistry; use PHPUnit\Metadata\TestWith; -use PHPUnit\Util\Reflection; use ReflectionClass; use ReflectionMethod; use Throwable; @@ -117,11 +113,7 @@ private function dataProvidedByMethods(string $className, string $methodName, Me $object = null; if (!$method->isPublic()) { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForTestMethodWithoutTestData( - $className, - $methodName, - ), + throw new InvalidDataProviderException( sprintf( 'Data Provider method %s::%s() is not public', $_dataProvider->className(), @@ -131,38 +123,26 @@ private function dataProvidedByMethods(string $className, string $methodName, Me } if (!$method->isStatic()) { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForTestMethodWithoutTestData( - $className, - $methodName, - ), + throw new InvalidDataProviderException( sprintf( 'Data Provider method %s::%s() is not static', $_dataProvider->className(), $_dataProvider->methodName(), ), ); - - $object = $class->newInstanceWithoutConstructor(); } - if ($method->getNumberOfParameters() === 0) { - $data = $method->invoke($object); - } else { - Event\Facade::emitter()->testTriggeredPhpunitDeprecation( - $this->valueObjectForTestMethodWithoutTestData( - $className, - $methodName, - ), + if ($method->getNumberOfParameters() > 0) { + throw new InvalidDataProviderException( sprintf( 'Data Provider method %s::%s() expects an argument', $_dataProvider->className(), $_dataProvider->methodName(), ), ); - - $data = $method->invoke($object, $_dataProvider->methodName()); } + + $data = $method->invoke($object); } catch (Throwable $e) { Event\Facade::emitter()->dataProviderMethodFinished( $testMethod, @@ -249,7 +229,7 @@ private function dataProvidedByTestWithAnnotation(string $className, string $met return null; } - $offset = strlen($matches[0][0]) + $matches[0][1]; + $offset = strlen($matches[0][0]) + (int) $matches[0][1]; $annotationContent = substr($docComment, $offset); $data = []; @@ -279,31 +259,4 @@ private function dataProvidedByTestWithAnnotation(string $className, string $met return $data; } - - /** - * @psalm-param class-string $className - * @psalm-param non-empty-string $methodName - * - * @throws MoreThanOneDataSetFromDataProviderException - */ - private function valueObjectForTestMethodWithoutTestData(string $className, string $methodName): TestMethod - { - $location = Reflection::sourceLocationFor($className, $methodName); - - return new TestMethod( - $className, - $methodName, - $location['file'], - $location['line'], - Event\Code\TestDoxBuilder::fromClassNameAndMethodName( - $className, - $methodName, - ), - MetadataRegistry::parser()->forClassAndMethod( - $className, - $methodName, - ), - TestDataCollection::fromArray([]), - ); - } } diff --git a/src/Metadata/IgnoreClassForCodeCoverage.php b/src/Metadata/IgnoreClassForCodeCoverage.php deleted file mode 100644 index 5887ccad88d..00000000000 --- a/src/Metadata/IgnoreClassForCodeCoverage.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Metadata; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 - */ -final class IgnoreClassForCodeCoverage extends Metadata -{ - /** - * @psalm-var class-string - */ - private readonly string $className; - - /** - * @psalm-param 0|1 $level - * @psalm-param class-string $className - */ - protected function __construct(int $level, string $className) - { - parent::__construct($level); - - $this->className = $className; - } - - /** - * @psalm-assert-if-true IgnoreClassForCodeCoverage $this - */ - public function isIgnoreClassForCodeCoverage(): bool - { - return true; - } - - /** - * @psalm-return class-string - */ - public function className(): string - { - return $this->className; - } -} diff --git a/src/Event/Exception/MoreThanOneDataSetFromDataProviderException.php b/src/Metadata/IgnoreDeprecations.php similarity index 59% rename from src/Event/Exception/MoreThanOneDataSetFromDataProviderException.php rename to src/Metadata/IgnoreDeprecations.php index 0d26b7f6cb8..b84a868c77d 100644 --- a/src/Event/Exception/MoreThanOneDataSetFromDataProviderException.php +++ b/src/Metadata/IgnoreDeprecations.php @@ -7,14 +7,20 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\Event\TestData; - -use PHPUnit\Event\Exception; -use RuntimeException; +namespace PHPUnit\Metadata; /** + * @psalm-immutable + * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MoreThanOneDataSetFromDataProviderException extends RuntimeException implements Exception +final class IgnoreDeprecations extends Metadata { + /** + * @psalm-assert-if-true IgnoreDeprecations $this + */ + public function isIgnoreDeprecations(): bool + { + return true; + } } diff --git a/src/Metadata/IgnoreFunctionForCodeCoverage.php b/src/Metadata/IgnoreFunctionForCodeCoverage.php deleted file mode 100644 index bc4c9b1e78d..00000000000 --- a/src/Metadata/IgnoreFunctionForCodeCoverage.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Metadata; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 - */ -final class IgnoreFunctionForCodeCoverage extends Metadata -{ - /** - * @psalm-var non-empty-string - */ - private readonly string $functionName; - - /** - * @psalm-param 0|1 $level - * @psalm-param non-empty-string $functionName - */ - protected function __construct(int $level, string $functionName) - { - parent::__construct($level); - - $this->functionName = $functionName; - } - - /** - * @psalm-assert-if-true IgnoreFunctionForCodeCoverage $this - */ - public function isIgnoreFunctionForCodeCoverage(): bool - { - return true; - } - - /** - * @psalm-return non-empty-string - */ - public function functionName(): string - { - return $this->functionName; - } -} diff --git a/src/Metadata/IgnoreMethodForCodeCoverage.php b/src/Metadata/IgnoreMethodForCodeCoverage.php deleted file mode 100644 index 398f0310d2a..00000000000 --- a/src/Metadata/IgnoreMethodForCodeCoverage.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Metadata; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 - */ -final class IgnoreMethodForCodeCoverage extends Metadata -{ - /** - * @psalm-var class-string - */ - private readonly string $className; - - /** - * @psalm-var non-empty-string - */ - private readonly string $methodName; - - /** - * @psalm-param 0|1 $level - * @psalm-param class-string $className - * @psalm-param non-empty-string $methodName - */ - protected function __construct(int $level, string $className, string $methodName) - { - parent::__construct($level); - - $this->className = $className; - $this->methodName = $methodName; - } - - /** - * @psalm-assert-if-true IgnoreMethodForCodeCoverage $this - */ - public function isIgnoreMethodForCodeCoverage(): bool - { - return true; - } - - /** - * @psalm-return class-string - */ - public function className(): string - { - return $this->className; - } - - /** - * @psalm-return non-empty-string - */ - public function methodName(): string - { - return $this->methodName; - } -} diff --git a/src/Metadata/IgnorePhpunitDeprecations.php b/src/Metadata/IgnorePhpunitDeprecations.php new file mode 100644 index 00000000000..30ef3fe64f3 --- /dev/null +++ b/src/Metadata/IgnorePhpunitDeprecations.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Metadata; + +/** + * @psalm-immutable + * + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class IgnorePhpunitDeprecations extends Metadata +{ + /** + * @psalm-assert-if-true IgnorePhpunitDeprecations $this + */ + public function isIgnorePhpunitDeprecations(): bool + { + return true; + } +} diff --git a/src/Metadata/Metadata.php b/src/Metadata/Metadata.php index 5821cf61d17..0e463a5050b 100644 --- a/src/Metadata/Metadata.php +++ b/src/Metadata/Metadata.php @@ -202,29 +202,30 @@ public static function groupOnMethod(string $groupName): Group return new Group(self::METHOD_LEVEL, $groupName); } - /** - * @psalm-param class-string $className - */ - public static function ignoreClassForCodeCoverage(string $className): IgnoreClassForCodeCoverage + public static function ignoreDeprecationsOnClass(): IgnoreDeprecations + { + return new IgnoreDeprecations(self::CLASS_LEVEL); + } + + public static function ignoreDeprecationsOnMethod(): IgnoreDeprecations { - return new IgnoreClassForCodeCoverage(self::CLASS_LEVEL, $className); + return new IgnoreDeprecations(self::METHOD_LEVEL); } /** - * @psalm-param class-string $className - * @psalm-param non-empty-string $methodName + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public static function ignoreMethodForCodeCoverage(string $className, string $methodName): IgnoreMethodForCodeCoverage + public static function ignorePhpunitDeprecationsOnClass(): IgnorePhpunitDeprecations { - return new IgnoreMethodForCodeCoverage(self::CLASS_LEVEL, $className, $methodName); + return new IgnorePhpunitDeprecations(self::CLASS_LEVEL); } /** - * @psalm-param non-empty-string $functionName + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public static function ignoreFunctionForCodeCoverage(string $functionName): IgnoreFunctionForCodeCoverage + public static function ignorePhpunitDeprecationsOnMethod(): IgnorePhpunitDeprecations { - return new IgnoreFunctionForCodeCoverage(self::CLASS_LEVEL, $functionName); + return new IgnorePhpunitDeprecations(self::METHOD_LEVEL); } public static function postCondition(): PostCondition @@ -616,25 +617,19 @@ public function isGroup(): bool } /** - * @psalm-assert-if-true IgnoreClassForCodeCoverage $this - */ - public function isIgnoreClassForCodeCoverage(): bool - { - return false; - } - - /** - * @psalm-assert-if-true IgnoreMethodForCodeCoverage $this + * @psalm-assert-if-true IgnoreDeprecations $this */ - public function isIgnoreMethodForCodeCoverage(): bool + public function isIgnoreDeprecations(): bool { return false; } /** - * @psalm-assert-if-true IgnoreFunctionForCodeCoverage $this + * @psalm-assert-if-true IgnorePhpunitDeprecations $this + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function isIgnoreFunctionForCodeCoverage(): bool + public function isIgnorePhpunitDeprecations(): bool { return false; } diff --git a/src/Metadata/MetadataCollection.php b/src/Metadata/MetadataCollection.php index 60799694194..ec39cf83020 100644 --- a/src/Metadata/MetadataCollection.php +++ b/src/Metadata/MetadataCollection.php @@ -22,12 +22,12 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class MetadataCollection implements Countable, IteratorAggregate +final readonly class MetadataCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $metadata; + private array $metadata; /** * @psalm-param list $metadata @@ -290,41 +290,25 @@ public function isGroup(): self ); } - /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 - */ - public function isIgnoreClassForCodeCoverage(): self - { - return new self( - ...array_filter( - $this->metadata, - static fn (Metadata $metadata): bool => $metadata->isIgnoreClassForCodeCoverage(), - ), - ); - } - - /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 - */ - public function isIgnoreMethodForCodeCoverage(): self + public function isIgnoreDeprecations(): self { return new self( ...array_filter( $this->metadata, - static fn (Metadata $metadata): bool => $metadata->isIgnoreMethodForCodeCoverage(), + static fn (Metadata $metadata): bool => $metadata->isIgnoreDeprecations(), ), ); } /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5513 + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function isIgnoreFunctionForCodeCoverage(): self + public function isIgnorePhpunitDeprecations(): self { return new self( ...array_filter( $this->metadata, - static fn (Metadata $metadata): bool => $metadata->isIgnoreFunctionForCodeCoverage(), + static fn (Metadata $metadata): bool => $metadata->isIgnorePhpunitDeprecations(), ), ); } diff --git a/src/Metadata/Parser/AnnotationParser.php b/src/Metadata/Parser/AnnotationParser.php index 7ce24a424b8..040b8a8a40d 100644 --- a/src/Metadata/Parser/AnnotationParser.php +++ b/src/Metadata/Parser/AnnotationParser.php @@ -10,16 +10,19 @@ namespace PHPUnit\Metadata\Parser; use function array_merge; +use function assert; use function count; use function explode; use function method_exists; use function preg_replace; use function rtrim; +use function sprintf; use function str_contains; use function str_starts_with; use function strlen; use function substr; use function trim; +use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Metadata\Annotation\Parser\Registry as AnnotationRegistry; use PHPUnit\Metadata\AnnotationsAreNotSupportedForInternalClassesException; use PHPUnit\Metadata\Metadata; @@ -35,6 +38,16 @@ */ final class AnnotationParser implements Parser { + /** + * @psalm-var array + */ + private static array $deprecationEmittedForClass = []; + + /** + * @psalm-var array + */ + private static array $deprecationEmittedForMethod = []; + /** * @psalm-param class-string $className * @@ -154,6 +167,19 @@ public function forClass(string $className): MetadataCollection ), ); + if (!empty($result) && + !isset(self::$deprecationEmittedForClass[$className]) && + !str_starts_with($className, 'PHPUnit\TestFixture')) { + EventFacade::emitter()->testRunnerTriggeredDeprecation( + sprintf( + 'Metadata found in doc-comment for class %s. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.', + $className, + ), + ); + + self::$deprecationEmittedForClass[$className] = true; + } + return MetadataCollection::fromArray($result); } @@ -249,15 +275,18 @@ public function forMethod(string $className, string $methodName): MetadataCollec } if (str_contains($value, '::')) { - [$className, $methodName] = explode('::', $value); + [$_className, $_methodName] = explode('::', $value); - if ($methodName === 'class') { - $result[] = Metadata::dependsOnClass($className, $deepClone, $shallowClone); + assert($_className !== ''); + assert($_methodName !== ''); + + if ($_methodName === 'class') { + $result[] = Metadata::dependsOnClass($_className, $deepClone, $shallowClone); continue; } - $result[] = Metadata::dependsOnMethod($className, $methodName, $deepClone, $shallowClone); + $result[] = Metadata::dependsOnMethod($_className, $_methodName, $deepClone, $shallowClone); continue; } @@ -369,6 +398,20 @@ public function forMethod(string $className, string $methodName): MetadataCollec ); } + if (!empty($result) && + !isset(self::$deprecationEmittedForMethod[$className . '::' . $methodName]) && + !str_starts_with($className, 'PHPUnit\TestFixture')) { + EventFacade::emitter()->testRunnerTriggeredDeprecation( + sprintf( + 'Metadata found in doc-comment for method %s::%s(). Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.', + $className, + $methodName, + ), + ); + + self::$deprecationEmittedForMethod[$className . '::' . $methodName] = true; + } + return MetadataCollection::fromArray($result); } diff --git a/src/Metadata/Parser/AttributeParser.php b/src/Metadata/Parser/AttributeParser.php index 97e0f831a03..82ddea9dfa9 100644 --- a/src/Metadata/Parser/AttributeParser.php +++ b/src/Metadata/Parser/AttributeParser.php @@ -37,9 +37,8 @@ use PHPUnit\Framework\Attributes\ExcludeGlobalVariableFromBackup; use PHPUnit\Framework\Attributes\ExcludeStaticPropertyFromBackup; use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage; -use PHPUnit\Framework\Attributes\IgnoreFunctionForCodeCoverage; -use PHPUnit\Framework\Attributes\IgnoreMethodForCodeCoverage; +use PHPUnit\Framework\Attributes\IgnoreDeprecations; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Large; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\PostCondition; @@ -163,24 +162,17 @@ public function forClass(string $className): MetadataCollection break; - case IgnoreClassForCodeCoverage::class: - assert($attributeInstance instanceof IgnoreClassForCodeCoverage); + case IgnoreDeprecations::class: + assert($attributeInstance instanceof IgnoreDeprecations); - $result[] = Metadata::ignoreClassForCodeCoverage($attributeInstance->className()); + $result[] = Metadata::ignoreDeprecationsOnClass(); break; - case IgnoreMethodForCodeCoverage::class: - assert($attributeInstance instanceof IgnoreMethodForCodeCoverage); + case IgnorePhpunitDeprecations::class: + assert($attributeInstance instanceof IgnorePhpunitDeprecations); - $result[] = Metadata::ignoreMethodForCodeCoverage($attributeInstance->className(), $attributeInstance->methodName()); - - break; - - case IgnoreFunctionForCodeCoverage::class: - assert($attributeInstance instanceof IgnoreFunctionForCodeCoverage); - - $result[] = Metadata::ignoreFunctionForCodeCoverage($attributeInstance->functionName()); + $result[] = Metadata::ignorePhpunitDeprecationsOnClass(); break; @@ -482,6 +474,20 @@ public function forMethod(string $className, string $methodName): MetadataCollec break; + case IgnoreDeprecations::class: + assert($attributeInstance instanceof IgnoreDeprecations); + + $result[] = Metadata::ignoreDeprecationsOnMethod(); + + break; + + case IgnorePhpunitDeprecations::class: + assert($attributeInstance instanceof IgnorePhpunitDeprecations); + + $result[] = Metadata::ignorePhpunitDeprecationsOnMethod(); + + break; + case PostCondition::class: $result[] = Metadata::postCondition(); diff --git a/src/Metadata/Parser/ParserChain.php b/src/Metadata/Parser/ParserChain.php index f00c52edb91..f094e9463fb 100644 --- a/src/Metadata/Parser/ParserChain.php +++ b/src/Metadata/Parser/ParserChain.php @@ -14,10 +14,10 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ParserChain implements Parser +final readonly class ParserChain implements Parser { - private readonly Parser $attributeReader; - private readonly Parser $annotationReader; + private Parser $attributeReader; + private Parser $annotationReader; public function __construct(Parser $attributeReader, Parser $annotationReader) { diff --git a/src/Runner/Baseline/Issue.php b/src/Runner/Baseline/Issue.php index d90b067b982..22ab54f3a74 100644 --- a/src/Runner/Baseline/Issue.php +++ b/src/Runner/Baseline/Issue.php @@ -18,27 +18,27 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class Issue +final readonly class Issue { /** * @psalm-var non-empty-string */ - private readonly string $file; + private string $file; /** * @psalm-var positive-int */ - private readonly int $line; + private int $line; /** * @psalm-var non-empty-string */ - private readonly string $hash; + private string $hash; /** * @psalm-var non-empty-string */ - private readonly string $description; + private string $description; /** * @psalm-param non-empty-string $file diff --git a/src/Runner/Baseline/RelativePathCalculator.php b/src/Runner/Baseline/RelativePathCalculator.php index 06ed7057de9..6e29beb90c3 100644 --- a/src/Runner/Baseline/RelativePathCalculator.php +++ b/src/Runner/Baseline/RelativePathCalculator.php @@ -26,12 +26,12 @@ * * @see Copied from https://github.com/phpstan/phpstan-src/blob/1.10.33/src/File/ParentDirectoryRelativePathHelper.php */ -final class RelativePathCalculator +final readonly class RelativePathCalculator { /** * @psalm-var non-empty-string $baselineDirectory */ - private readonly string $baselineDirectory; + private string $baselineDirectory; /** * @psalm-param non-empty-string $baselineDirectory diff --git a/src/Runner/CodeCoverage.php b/src/Runner/CodeCoverage.php index 55a8df84a7e..c726ed1b8ca 100644 --- a/src/Runner/CodeCoverage.php +++ b/src/Runner/CodeCoverage.php @@ -12,7 +12,6 @@ use function file_put_contents; use function sprintf; use PHPUnit\Event\Facade as EventFacade; -use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException; use PHPUnit\Event\TestData\NoDataSetFromDataProviderException; use PHPUnit\Framework\TestCase; use PHPUnit\TextUI\Configuration\CodeCoverageFilterRegistry; @@ -140,7 +139,6 @@ public function driver(): Driver } /** - * @throws MoreThanOneDataSetFromDataProviderException * @throws NoDataSetFromDataProviderException */ public function start(TestCase $test): void diff --git a/src/Runner/ErrorHandler.php b/src/Runner/ErrorHandler.php index f8ac78fc2f8..2b012fad2eb 100644 --- a/src/Runner/ErrorHandler.php +++ b/src/Runner/ErrorHandler.php @@ -50,13 +50,16 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil return false; } + $test = Event\Code\TestMethodBuilder::fromCallStack(); + $ignoredByBaseline = $this->ignoredByBaseline($errorFile, $errorLine, $errorString); + $ignoredByTest = $test->metadata()->isIgnoreDeprecations()->isNotEmpty(); switch ($errorNumber) { case E_NOTICE: case E_STRICT: Event\Facade::emitter()->testTriggeredPhpNotice( - Event\Code\TestMethodBuilder::fromCallStack(), + $test, $errorString, $errorFile, $errorLine, @@ -68,7 +71,7 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil case E_USER_NOTICE: Event\Facade::emitter()->testTriggeredNotice( - Event\Code\TestMethodBuilder::fromCallStack(), + $test, $errorString, $errorFile, $errorLine, @@ -80,7 +83,7 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil case E_WARNING: Event\Facade::emitter()->testTriggeredPhpWarning( - Event\Code\TestMethodBuilder::fromCallStack(), + $test, $errorString, $errorFile, $errorLine, @@ -92,7 +95,7 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil case E_USER_WARNING: Event\Facade::emitter()->testTriggeredWarning( - Event\Code\TestMethodBuilder::fromCallStack(), + $test, $errorString, $errorFile, $errorLine, @@ -104,31 +107,33 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil case E_DEPRECATED: Event\Facade::emitter()->testTriggeredPhpDeprecation( - Event\Code\TestMethodBuilder::fromCallStack(), + $test, $errorString, $errorFile, $errorLine, $suppressed, $ignoredByBaseline, + $ignoredByTest, ); break; case E_USER_DEPRECATED: Event\Facade::emitter()->testTriggeredDeprecation( - Event\Code\TestMethodBuilder::fromCallStack(), + $test, $errorString, $errorFile, $errorLine, $suppressed, $ignoredByBaseline, + $ignoredByTest, ); break; case E_USER_ERROR: Event\Facade::emitter()->testTriggeredError( - Event\Code\TestMethodBuilder::fromCallStack(), + $test, $errorString, $errorFile, $errorLine, diff --git a/src/Runner/Extension/ExtensionBootstrapper.php b/src/Runner/Extension/ExtensionBootstrapper.php index fc8f317502a..e7057652dd9 100644 --- a/src/Runner/Extension/ExtensionBootstrapper.php +++ b/src/Runner/Extension/ExtensionBootstrapper.php @@ -23,10 +23,10 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ExtensionBootstrapper +final readonly class ExtensionBootstrapper { - private readonly Configuration $configuration; - private readonly Facade $facade; + private Configuration $configuration; + private Facade $facade; public function __construct(Configuration $configuration, Facade $facade) { diff --git a/src/Runner/Extension/ParameterCollection.php b/src/Runner/Extension/ParameterCollection.php index 08b09966f00..329107e9bdd 100644 --- a/src/Runner/Extension/ParameterCollection.php +++ b/src/Runner/Extension/ParameterCollection.php @@ -17,9 +17,9 @@ * * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class ParameterCollection +final readonly class ParameterCollection { - private readonly array $parameters; + private array $parameters; /** * @psalm-param array $parameters diff --git a/src/Runner/Filter/TestIdFilterIterator.php b/src/Runner/Filter/TestIdFilterIterator.php index 6c44289605b..33fbd351208 100644 --- a/src/Runner/Filter/TestIdFilterIterator.php +++ b/src/Runner/Filter/TestIdFilterIterator.php @@ -10,7 +10,6 @@ namespace PHPUnit\Runner\Filter; use function in_array; -use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException; use PHPUnit\Event\TestData\NoDataSetFromDataProviderException; use PHPUnit\Framework\Test; use PHPUnit\Framework\TestCase; @@ -54,7 +53,7 @@ public function accept(): bool try { return in_array($test->valueObjectForEvents()->id(), $this->testIds, true); - } catch (MoreThanOneDataSetFromDataProviderException|NoDataSetFromDataProviderException) { + } catch (NoDataSetFromDataProviderException) { return false; } } diff --git a/src/Runner/TestResult/Collector.php b/src/Runner/TestResult/Collector.php index f6d3acc4710..bd6d540a931 100644 --- a/src/Runner/TestResult/Collector.php +++ b/src/Runner/TestResult/Collector.php @@ -348,6 +348,10 @@ public function testConsideredRisky(ConsideredRisky $event): void public function testTriggeredDeprecation(DeprecationTriggered $event): void { + if ($event->ignoredByTest()) { + return; + } + if ($event->ignoredByBaseline()) { $this->numberOfIssuesIgnoredByBaseline++; @@ -380,6 +384,10 @@ public function testTriggeredDeprecation(DeprecationTriggered $event): void public function testTriggeredPhpDeprecation(PhpDeprecationTriggered $event): void { + if ($event->ignoredByTest()) { + return; + } + if ($event->ignoredByBaseline()) { $this->numberOfIssuesIgnoredByBaseline++; diff --git a/src/Runner/TestResult/TestResult.php b/src/Runner/TestResult/TestResult.php index 0944b7cf429..2c572608b94 100644 --- a/src/Runner/TestResult/TestResult.php +++ b/src/Runner/TestResult/TestResult.php @@ -27,106 +27,106 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class TestResult +final readonly class TestResult { - private readonly int $numberOfTests; - private readonly int $numberOfTestsRun; - private readonly int $numberOfAssertions; + private int $numberOfTests; + private int $numberOfTestsRun; + private int $numberOfAssertions; /** * @psalm-var list */ - private readonly array $testErroredEvents; + private array $testErroredEvents; /** * @psalm-var list */ - private readonly array $testFailedEvents; + private array $testFailedEvents; /** * @psalm-var list */ - private readonly array $testMarkedIncompleteEvents; + private array $testMarkedIncompleteEvents; /** * @psalm-var list */ - private readonly array $testSuiteSkippedEvents; + private array $testSuiteSkippedEvents; /** * @psalm-var list */ - private readonly array $testSkippedEvents; + private array $testSkippedEvents; /** * @psalm-var array> */ - private readonly array $testConsideredRiskyEvents; + private array $testConsideredRiskyEvents; /** * @psalm-var array> */ - private readonly array $testTriggeredPhpunitDeprecationEvents; + private array $testTriggeredPhpunitDeprecationEvents; /** * @psalm-var array> */ - private readonly array $testTriggeredPhpunitErrorEvents; + private array $testTriggeredPhpunitErrorEvents; /** * @psalm-var array> */ - private readonly array $testTriggeredPhpunitWarningEvents; + private array $testTriggeredPhpunitWarningEvents; /** * @psalm-var list */ - private readonly array $testRunnerTriggeredDeprecationEvents; + private array $testRunnerTriggeredDeprecationEvents; /** * @psalm-var list */ - private readonly array $testRunnerTriggeredWarningEvents; + private array $testRunnerTriggeredWarningEvents; /** * @psalm-var list */ - private readonly array $errors; + private array $errors; /** * @psalm-var list */ - private readonly array $deprecations; + private array $deprecations; /** * @psalm-var list */ - private readonly array $notices; + private array $notices; /** * @psalm-var list */ - private readonly array $warnings; + private array $warnings; /** * @psalm-var list */ - private readonly array $phpDeprecations; + private array $phpDeprecations; /** * @psalm-var list */ - private readonly array $phpNotices; + private array $phpNotices; /** * @psalm-var list */ - private readonly array $phpWarnings; + private array $phpWarnings; /** * @psalm-var non-negative-int */ - private readonly int $numberOfIssuesIgnoredByBaseline; + private int $numberOfIssuesIgnoredByBaseline; /** * @psalm-param list $testErroredEvents diff --git a/src/Runner/Version.php b/src/Runner/Version.php index 09a7dfb1227..3f541d87c06 100644 --- a/src/Runner/Version.php +++ b/src/Runner/Version.php @@ -34,7 +34,7 @@ public static function id(): string } if (self::$version === '') { - self::$version = (new VersionId('10.5', dirname(__DIR__, 2)))->asString(); + self::$version = (new VersionId('11.0', dirname(__DIR__, 2)))->asString(); } return self::$version; diff --git a/src/TextUI/Application.php b/src/TextUI/Application.php index fa4cbb795c7..35368780ede 100644 --- a/src/TextUI/Application.php +++ b/src/TextUI/Application.php @@ -27,7 +27,6 @@ use PHPUnit\Logging\TestDox\HtmlRenderer as TestDoxHtmlRenderer; use PHPUnit\Logging\TestDox\PlainTextRenderer as TestDoxTextRenderer; use PHPUnit\Logging\TestDox\TestResultCollector as TestDoxResultCollector; -use PHPUnit\Metadata\Api\CodeCoverage as CodeCoverageMetadataApi; use PHPUnit\Runner\Baseline\CannotLoadBaselineException; use PHPUnit\Runner\Baseline\Generator as BaselineGenerator; use PHPUnit\Runner\Baseline\Reader; @@ -142,12 +141,6 @@ public function run(array $argv): int $extensionRequiresCodeCoverageCollection, ); - if (CodeCoverage::instance()->isActive()) { - CodeCoverage::instance()->ignoreLines( - (new CodeCoverageMetadataApi)->linesToBeIgnored($testSuite), - ); - } - $printer = OutputFacade::init( $configuration, $extensionReplacesProgressOutput, diff --git a/src/TextUI/Command/Commands/AtLeastVersionCommand.php b/src/TextUI/Command/Commands/AtLeastVersionCommand.php index 2fe62c51775..0d776af09a7 100644 --- a/src/TextUI/Command/Commands/AtLeastVersionCommand.php +++ b/src/TextUI/Command/Commands/AtLeastVersionCommand.php @@ -15,9 +15,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class AtLeastVersionCommand implements Command +final readonly class AtLeastVersionCommand implements Command { - private readonly string $version; + private string $version; public function __construct(string $version) { diff --git a/src/TextUI/Command/Commands/ListGroupsCommand.php b/src/TextUI/Command/Commands/ListGroupsCommand.php index e014d3f0a9d..01489579e67 100644 --- a/src/TextUI/Command/Commands/ListGroupsCommand.php +++ b/src/TextUI/Command/Commands/ListGroupsCommand.php @@ -18,9 +18,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ListGroupsCommand implements Command +final readonly class ListGroupsCommand implements Command { - private readonly TestSuite $suite; + private TestSuite $suite; public function __construct(TestSuite $suite) { diff --git a/src/TextUI/Command/Commands/ListTestSuitesCommand.php b/src/TextUI/Command/Commands/ListTestSuitesCommand.php index 78c17116453..82ce790722f 100644 --- a/src/TextUI/Command/Commands/ListTestSuitesCommand.php +++ b/src/TextUI/Command/Commands/ListTestSuitesCommand.php @@ -16,9 +16,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ListTestSuitesCommand implements Command +final readonly class ListTestSuitesCommand implements Command { - private readonly TestSuiteCollection $suites; + private TestSuiteCollection $suites; public function __construct(TestSuiteCollection $suites) { diff --git a/src/TextUI/Command/Commands/ListTestsAsTextCommand.php b/src/TextUI/Command/Commands/ListTestsAsTextCommand.php index c376a631d2c..dd771b18189 100644 --- a/src/TextUI/Command/Commands/ListTestsAsTextCommand.php +++ b/src/TextUI/Command/Commands/ListTestsAsTextCommand.php @@ -20,9 +20,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ListTestsAsTextCommand implements Command +final readonly class ListTestsAsTextCommand implements Command { - private readonly TestSuite $suite; + private TestSuite $suite; public function __construct(TestSuite $suite) { diff --git a/src/TextUI/Command/Commands/ListTestsAsXmlCommand.php b/src/TextUI/Command/Commands/ListTestsAsXmlCommand.php index acb4500c03b..19638b0f22e 100644 --- a/src/TextUI/Command/Commands/ListTestsAsXmlCommand.php +++ b/src/TextUI/Command/Commands/ListTestsAsXmlCommand.php @@ -12,7 +12,6 @@ use function file_put_contents; use function implode; use function sprintf; -use function str_replace; use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestSuite; use PHPUnit\Runner\PhptTestCase; @@ -23,10 +22,10 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ListTestsAsXmlCommand implements Command +final readonly class ListTestsAsXmlCommand implements Command { - private readonly string $filename; - private readonly TestSuite $suite; + private string $filename; + private TestSuite $suite; public function __construct(string $filename, TestSuite $suite) { @@ -63,21 +62,6 @@ public function execute(): Result $writer->writeAttribute('id', $test->valueObjectForEvents()->id()); $writer->writeAttribute('name', $test->name()); $writer->writeAttribute('groups', implode(',', $test->groups())); - - /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5481 - */ - if (!empty($test->dataSetAsString())) { - $writer->writeAttribute( - 'dataSet', - str_replace( - ' with data set ', - '', - $test->dataSetAsString(), - ), - ); - } - $writer->endElement(); continue; diff --git a/src/TextUI/Command/Commands/MigrateConfigurationCommand.php b/src/TextUI/Command/Commands/MigrateConfigurationCommand.php index 50001940e35..428410fc803 100644 --- a/src/TextUI/Command/Commands/MigrateConfigurationCommand.php +++ b/src/TextUI/Command/Commands/MigrateConfigurationCommand.php @@ -17,9 +17,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class MigrateConfigurationCommand implements Command +final readonly class MigrateConfigurationCommand implements Command { - private readonly string $filename; + private string $filename; public function __construct(string $filename) { diff --git a/src/TextUI/Command/Commands/ShowHelpCommand.php b/src/TextUI/Command/Commands/ShowHelpCommand.php index aae306e58c7..c58231f8b17 100644 --- a/src/TextUI/Command/Commands/ShowHelpCommand.php +++ b/src/TextUI/Command/Commands/ShowHelpCommand.php @@ -14,9 +14,9 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ShowHelpCommand implements Command +final readonly class ShowHelpCommand implements Command { - private readonly int $shellExitCode; + private int $shellExitCode; public function __construct(int $shellExitCode) { diff --git a/src/TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php b/src/TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php index 8af15b65bf9..abd81f9a9ec 100644 --- a/src/TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php +++ b/src/TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php @@ -20,10 +20,10 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class WarmCodeCoverageCacheCommand implements Command +final readonly class WarmCodeCoverageCacheCommand implements Command { - private readonly Configuration $configuration; - private readonly CodeCoverageFilterRegistry $codeCoverageFilterRegistry; + private Configuration $configuration; + private CodeCoverageFilterRegistry $codeCoverageFilterRegistry; public function __construct(Configuration $configuration, CodeCoverageFilterRegistry $codeCoverageFilterRegistry) { diff --git a/src/TextUI/Configuration/Cli/Builder.php b/src/TextUI/Configuration/Cli/Builder.php index 034656bf7a6..7a4bc9d7622 100644 --- a/src/TextUI/Configuration/Cli/Builder.php +++ b/src/TextUI/Configuration/Cli/Builder.php @@ -31,12 +31,10 @@ final class Builder 'cache-result', 'do-not-cache-result', 'cache-directory=', - 'cache-result-file=', 'check-version', 'colors==', 'columns=', 'configuration=', - 'coverage-cache=', 'warm-coverage-cache', 'coverage-filter=', 'coverage-clover=', @@ -151,12 +149,10 @@ public function fromParameters(array $parameters): Configuration $bootstrap = null; $cacheDirectory = null; $cacheResult = null; - $cacheResultFile = null; $checkVersion = false; $colors = null; $columns = null; $configuration = null; - $coverageCacheDirectory = null; $warmCoverageCache = false; $coverageFilter = null; $coverageClover = null; @@ -268,11 +264,6 @@ public function fromParameters(array $parameters): Configuration break; - case '--cache-result-file': - $cacheResultFile = $option[1]; - - break; - case '--columns': if (is_numeric($option[1])) { $columns = (int) $option[1]; @@ -288,11 +279,6 @@ public function fromParameters(array $parameters): Configuration break; - case '--coverage-cache': - $coverageCacheDirectory = $option[1]; - - break; - case '--warm-coverage-cache': $warmCoverageCache = true; @@ -831,7 +817,6 @@ public function fromParameters(array $parameters): Configuration $bootstrap, $cacheDirectory, $cacheResult, - $cacheResultFile, $checkVersion, $colors, $columns, @@ -846,7 +831,6 @@ public function fromParameters(array $parameters): Configuration $coverageTextShowOnlySummary, $coverageXml, $pathCoverage, - $coverageCacheDirectory, $warmCoverageCache, $defaultTimeLimit, $disableCodeCoverageIgnore, diff --git a/src/TextUI/Configuration/Cli/Configuration.php b/src/TextUI/Configuration/Cli/Configuration.php index cca980eadaa..7f4b880fccc 100644 --- a/src/TextUI/Configuration/Cli/Configuration.php +++ b/src/TextUI/Configuration/Cli/Configuration.php @@ -14,118 +14,116 @@ * * @psalm-immutable */ -final class Configuration +final readonly class Configuration { /** * @psalm-var list */ - private readonly array $arguments; - private readonly ?string $atLeastVersion; - private readonly ?bool $backupGlobals; - private readonly ?bool $backupStaticProperties; - private readonly ?bool $beStrictAboutChangesToGlobalState; - private readonly ?string $bootstrap; - private readonly ?string $cacheDirectory; - private readonly ?bool $cacheResult; - private readonly ?string $cacheResultFile; - private readonly bool $checkVersion; - private readonly ?string $colors; - private readonly null|int|string $columns; - private readonly ?string $configurationFile; - private readonly ?array $coverageFilter; - private readonly ?string $coverageClover; - private readonly ?string $coverageCobertura; - private readonly ?string $coverageCrap4J; - private readonly ?string $coverageHtml; - private readonly ?string $coveragePhp; - private readonly ?string $coverageText; - private readonly ?bool $coverageTextShowUncoveredFiles; - private readonly ?bool $coverageTextShowOnlySummary; - private readonly ?string $coverageXml; - private readonly ?bool $pathCoverage; - private readonly ?string $coverageCacheDirectory; - private readonly bool $warmCoverageCache; - private readonly ?int $defaultTimeLimit; - private readonly ?bool $disableCodeCoverageIgnore; - private readonly ?bool $disallowTestOutput; - private readonly ?bool $enforceTimeLimit; - private readonly ?array $excludeGroups; - private readonly ?int $executionOrder; - private readonly ?int $executionOrderDefects; - private readonly ?bool $failOnDeprecation; - private readonly ?bool $failOnEmptyTestSuite; - private readonly ?bool $failOnIncomplete; - private readonly ?bool $failOnNotice; - private readonly ?bool $failOnRisky; - private readonly ?bool $failOnSkipped; - private readonly ?bool $failOnWarning; - private readonly ?bool $stopOnDefect; - private readonly ?bool $stopOnDeprecation; - private readonly ?bool $stopOnError; - private readonly ?bool $stopOnFailure; - private readonly ?bool $stopOnIncomplete; - private readonly ?bool $stopOnNotice; - private readonly ?bool $stopOnRisky; - private readonly ?bool $stopOnSkipped; - private readonly ?bool $stopOnWarning; - private readonly ?string $filter; - private readonly ?string $generateBaseline; - private readonly ?string $useBaseline; - private readonly bool $ignoreBaseline; - private readonly bool $generateConfiguration; - private readonly bool $migrateConfiguration; - private readonly ?array $groups; - private readonly ?array $testsCovering; - private readonly ?array $testsUsing; - private readonly bool $help; - private readonly ?string $includePath; - private readonly ?array $iniSettings; - private readonly ?string $junitLogfile; - private readonly bool $listGroups; - private readonly bool $listSuites; - private readonly bool $listTests; - private readonly ?string $listTestsXml; - private readonly ?bool $noCoverage; - private readonly ?bool $noExtensions; - private readonly ?bool $noOutput; - private readonly ?bool $noProgress; - private readonly ?bool $noResults; - private readonly ?bool $noLogging; - private readonly ?bool $processIsolation; - private readonly ?int $randomOrderSeed; - private readonly ?bool $reportUselessTests; - private readonly ?bool $resolveDependencies; - private readonly ?bool $reverseList; - private readonly ?bool $stderr; - private readonly ?bool $strictCoverage; - private readonly ?string $teamcityLogfile; - private readonly ?bool $teamCityPrinter; - private readonly ?string $testdoxHtmlFile; - private readonly ?string $testdoxTextFile; - private readonly ?bool $testdoxPrinter; + private array $arguments; + private ?string $atLeastVersion; + private ?bool $backupGlobals; + private ?bool $backupStaticProperties; + private ?bool $beStrictAboutChangesToGlobalState; + private ?string $bootstrap; + private ?string $cacheDirectory; + private ?bool $cacheResult; + private bool $checkVersion; + private ?string $colors; + private null|int|string $columns; + private ?string $configurationFile; + private ?array $coverageFilter; + private ?string $coverageClover; + private ?string $coverageCobertura; + private ?string $coverageCrap4J; + private ?string $coverageHtml; + private ?string $coveragePhp; + private ?string $coverageText; + private ?bool $coverageTextShowUncoveredFiles; + private ?bool $coverageTextShowOnlySummary; + private ?string $coverageXml; + private ?bool $pathCoverage; + private bool $warmCoverageCache; + private ?int $defaultTimeLimit; + private ?bool $disableCodeCoverageIgnore; + private ?bool $disallowTestOutput; + private ?bool $enforceTimeLimit; + private ?array $excludeGroups; + private ?int $executionOrder; + private ?int $executionOrderDefects; + private ?bool $failOnDeprecation; + private ?bool $failOnEmptyTestSuite; + private ?bool $failOnIncomplete; + private ?bool $failOnNotice; + private ?bool $failOnRisky; + private ?bool $failOnSkipped; + private ?bool $failOnWarning; + private ?bool $stopOnDefect; + private ?bool $stopOnDeprecation; + private ?bool $stopOnError; + private ?bool $stopOnFailure; + private ?bool $stopOnIncomplete; + private ?bool $stopOnNotice; + private ?bool $stopOnRisky; + private ?bool $stopOnSkipped; + private ?bool $stopOnWarning; + private ?string $filter; + private ?string $generateBaseline; + private ?string $useBaseline; + private bool $ignoreBaseline; + private bool $generateConfiguration; + private bool $migrateConfiguration; + private ?array $groups; + private ?array $testsCovering; + private ?array $testsUsing; + private bool $help; + private ?string $includePath; + private ?array $iniSettings; + private ?string $junitLogfile; + private bool $listGroups; + private bool $listSuites; + private bool $listTests; + private ?string $listTestsXml; + private ?bool $noCoverage; + private ?bool $noExtensions; + private ?bool $noOutput; + private ?bool $noProgress; + private ?bool $noResults; + private ?bool $noLogging; + private ?bool $processIsolation; + private ?int $randomOrderSeed; + private ?bool $reportUselessTests; + private ?bool $resolveDependencies; + private ?bool $reverseList; + private ?bool $stderr; + private ?bool $strictCoverage; + private ?string $teamcityLogfile; + private ?bool $teamCityPrinter; + private ?string $testdoxHtmlFile; + private ?string $testdoxTextFile; + private ?bool $testdoxPrinter; /** * @psalm-var ?non-empty-list */ - private readonly ?array $testSuffixes; - private readonly ?string $testSuite; - private readonly ?string $excludeTestSuite; - private readonly bool $useDefaultConfiguration; - private readonly ?bool $displayDetailsOnIncompleteTests; - private readonly ?bool $displayDetailsOnSkippedTests; - private readonly ?bool $displayDetailsOnTestsThatTriggerDeprecations; - private readonly ?bool $displayDetailsOnTestsThatTriggerErrors; - private readonly ?bool $displayDetailsOnTestsThatTriggerNotices; - private readonly ?bool $displayDetailsOnTestsThatTriggerWarnings; - private readonly bool $version; - private readonly ?string $logEventsText; - private readonly ?string $logEventsVerboseText; + private ?array $testSuffixes; + private ?string $testSuite; + private ?string $excludeTestSuite; + private bool $useDefaultConfiguration; + private ?bool $displayDetailsOnIncompleteTests; + private ?bool $displayDetailsOnSkippedTests; + private ?bool $displayDetailsOnTestsThatTriggerDeprecations; + private ?bool $displayDetailsOnTestsThatTriggerErrors; + private ?bool $displayDetailsOnTestsThatTriggerNotices; + private ?bool $displayDetailsOnTestsThatTriggerWarnings; + private bool $version; + private ?string $logEventsText; + private ?string $logEventsVerboseText; /** * @psalm-param list $arguments * @psalm-param ?non-empty-list $testSuffixes */ - public function __construct(array $arguments, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticProperties, ?bool $beStrictAboutChangesToGlobalState, ?string $bootstrap, ?string $cacheDirectory, ?bool $cacheResult, ?string $cacheResultFile, bool $checkVersion, ?string $colors, null|int|string $columns, ?string $configurationFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $pathCoverage, ?string $coverageCacheDirectory, bool $warmCoverageCache, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?bool $failOnDeprecation, ?bool $failOnEmptyTestSuite, ?bool $failOnIncomplete, ?bool $failOnNotice, ?bool $failOnRisky, ?bool $failOnSkipped, ?bool $failOnWarning, ?bool $stopOnDefect, ?bool $stopOnDeprecation, ?bool $stopOnError, ?bool $stopOnFailure, ?bool $stopOnIncomplete, ?bool $stopOnNotice, ?bool $stopOnRisky, ?bool $stopOnSkipped, ?bool $stopOnWarning, ?string $filter, ?string $generateBaseline, ?string $useBaseline, bool $ignoreBaseline, bool $generateConfiguration, bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, bool $listGroups, bool $listSuites, bool $listTests, ?string $listTestsXml, ?bool $noCoverage, ?bool $noExtensions, ?bool $noOutput, ?bool $noProgress, ?bool $noResults, ?bool $noLogging, ?bool $processIsolation, ?int $randomOrderSeed, ?bool $reportUselessTests, ?bool $resolveDependencies, ?bool $reverseList, ?bool $stderr, ?bool $strictCoverage, ?string $teamcityLogfile, ?string $testdoxHtmlFile, ?string $testdoxTextFile, ?array $testSuffixes, ?string $testSuite, ?string $excludeTestSuite, bool $useDefaultConfiguration, ?bool $displayDetailsOnIncompleteTests, ?bool $displayDetailsOnSkippedTests, ?bool $displayDetailsOnTestsThatTriggerDeprecations, ?bool $displayDetailsOnTestsThatTriggerErrors, ?bool $displayDetailsOnTestsThatTriggerNotices, ?bool $displayDetailsOnTestsThatTriggerWarnings, bool $version, ?array $coverageFilter, ?string $logEventsText, ?string $logEventsVerboseText, ?bool $printerTeamCity, ?bool $printerTestDox) + public function __construct(array $arguments, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticProperties, ?bool $beStrictAboutChangesToGlobalState, ?string $bootstrap, ?string $cacheDirectory, ?bool $cacheResult, bool $checkVersion, ?string $colors, null|int|string $columns, ?string $configurationFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $pathCoverage, bool $warmCoverageCache, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?bool $failOnDeprecation, ?bool $failOnEmptyTestSuite, ?bool $failOnIncomplete, ?bool $failOnNotice, ?bool $failOnRisky, ?bool $failOnSkipped, ?bool $failOnWarning, ?bool $stopOnDefect, ?bool $stopOnDeprecation, ?bool $stopOnError, ?bool $stopOnFailure, ?bool $stopOnIncomplete, ?bool $stopOnNotice, ?bool $stopOnRisky, ?bool $stopOnSkipped, ?bool $stopOnWarning, ?string $filter, ?string $generateBaseline, ?string $useBaseline, bool $ignoreBaseline, bool $generateConfiguration, bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, bool $listGroups, bool $listSuites, bool $listTests, ?string $listTestsXml, ?bool $noCoverage, ?bool $noExtensions, ?bool $noOutput, ?bool $noProgress, ?bool $noResults, ?bool $noLogging, ?bool $processIsolation, ?int $randomOrderSeed, ?bool $reportUselessTests, ?bool $resolveDependencies, ?bool $reverseList, ?bool $stderr, ?bool $strictCoverage, ?string $teamcityLogfile, ?string $testdoxHtmlFile, ?string $testdoxTextFile, ?array $testSuffixes, ?string $testSuite, ?string $excludeTestSuite, bool $useDefaultConfiguration, ?bool $displayDetailsOnIncompleteTests, ?bool $displayDetailsOnSkippedTests, ?bool $displayDetailsOnTestsThatTriggerDeprecations, ?bool $displayDetailsOnTestsThatTriggerErrors, ?bool $displayDetailsOnTestsThatTriggerNotices, ?bool $displayDetailsOnTestsThatTriggerWarnings, bool $version, ?array $coverageFilter, ?string $logEventsText, ?string $logEventsVerboseText, ?bool $printerTeamCity, ?bool $printerTestDox) { $this->arguments = $arguments; $this->atLeastVersion = $atLeastVersion; @@ -135,7 +133,6 @@ public function __construct(array $arguments, ?string $atLeastVersion, ?bool $ba $this->bootstrap = $bootstrap; $this->cacheDirectory = $cacheDirectory; $this->cacheResult = $cacheResult; - $this->cacheResultFile = $cacheResultFile; $this->checkVersion = $checkVersion; $this->colors = $colors; $this->columns = $columns; @@ -151,7 +148,6 @@ public function __construct(array $arguments, ?string $atLeastVersion, ?bool $ba $this->coverageTextShowOnlySummary = $coverageTextShowOnlySummary; $this->coverageXml = $coverageXml; $this->pathCoverage = $pathCoverage; - $this->coverageCacheDirectory = $coverageCacheDirectory; $this->warmCoverageCache = $warmCoverageCache; $this->defaultTimeLimit = $defaultTimeLimit; $this->disableCodeCoverageIgnore = $disableCodeCoverageIgnore; @@ -374,30 +370,6 @@ public function cacheResult(): bool return $this->cacheResult; } - /** - * @psalm-assert-if-true !null $this->cacheResultFile - * - * @deprecated - */ - public function hasCacheResultFile(): bool - { - return $this->cacheResultFile !== null; - } - - /** - * @throws Exception - * - * @deprecated - */ - public function cacheResultFile(): string - { - if (!$this->hasCacheResultFile()) { - throw new Exception; - } - - return $this->cacheResultFile; - } - public function checkVersion(): bool { return $this->checkVersion; @@ -683,30 +655,6 @@ public function pathCoverage(): bool return $this->pathCoverage; } - /** - * @psalm-assert-if-true !null $this->coverageCacheDirectory - * - * @deprecated - */ - public function hasCoverageCacheDirectory(): bool - { - return $this->coverageCacheDirectory !== null; - } - - /** - * @throws Exception - * - * @deprecated - */ - public function coverageCacheDirectory(): string - { - if (!$this->hasCoverageCacheDirectory()) { - throw new Exception; - } - - return $this->coverageCacheDirectory; - } - public function warmCoverageCache(): bool { return $this->warmCoverageCache; diff --git a/src/TextUI/Configuration/Merger.php b/src/TextUI/Configuration/Merger.php index 95f595a4551..9ef87427c82 100644 --- a/src/TextUI/Configuration/Merger.php +++ b/src/TextUI/Configuration/Merger.php @@ -77,20 +77,8 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC $testResultCacheFile = $cacheDirectory . DIRECTORY_SEPARATOR . 'test-results'; } - if ($coverageCacheDirectory === null) { - if ($cliConfiguration->hasCoverageCacheDirectory() && Filesystem::createDirectory($cliConfiguration->coverageCacheDirectory())) { - $coverageCacheDirectory = realpath($cliConfiguration->coverageCacheDirectory()); - } elseif ($xmlConfiguration->codeCoverage()->hasCacheDirectory()) { - $coverageCacheDirectory = $xmlConfiguration->codeCoverage()->cacheDirectory()->path(); - } - } - if (!isset($testResultCacheFile)) { - if ($cliConfiguration->hasCacheResultFile()) { - $testResultCacheFile = $cliConfiguration->cacheResultFile(); - } elseif ($xmlConfiguration->phpunit()->hasCacheResultFile()) { - $testResultCacheFile = $xmlConfiguration->phpunit()->cacheResultFile(); - } elseif ($xmlConfiguration->wasLoadedFromFile()) { + if ($xmlConfiguration->wasLoadedFromFile()) { $testResultCacheFile = dirname(realpath($xmlConfiguration->filename())) . DIRECTORY_SEPARATOR . '.phpunit.result.cache'; } else { $candidate = realpath($_SERVER['PHP_SELF']); @@ -681,24 +669,14 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC } } - if ($xmlConfiguration->codeCoverage()->hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport()) { - foreach ($xmlConfiguration->codeCoverage()->directories() as $directory) { - $sourceIncludeDirectories[] = $directory; - } - - $sourceIncludeFiles = $xmlConfiguration->codeCoverage()->files(); - $sourceExcludeDirectories = $xmlConfiguration->codeCoverage()->excludeDirectories(); - $sourceExcludeFiles = $xmlConfiguration->codeCoverage()->excludeFiles(); - } else { - foreach ($xmlConfiguration->source()->includeDirectories() as $directory) { - $sourceIncludeDirectories[] = $directory; - } - - $sourceIncludeFiles = $xmlConfiguration->source()->includeFiles(); - $sourceExcludeDirectories = $xmlConfiguration->source()->excludeDirectories(); - $sourceExcludeFiles = $xmlConfiguration->source()->excludeFiles(); + foreach ($xmlConfiguration->source()->includeDirectories() as $directory) { + $sourceIncludeDirectories[] = $directory; } + $sourceIncludeFiles = $xmlConfiguration->source()->includeFiles(); + $sourceExcludeDirectories = $xmlConfiguration->source()->excludeDirectories(); + $sourceExcludeFiles = $xmlConfiguration->source()->excludeFiles(); + $useBaseline = null; $generateBaseline = null; diff --git a/src/TextUI/Configuration/Value/Constant.php b/src/TextUI/Configuration/Value/Constant.php index 0ec9487e104..e2d43042fdd 100644 --- a/src/TextUI/Configuration/Value/Constant.php +++ b/src/TextUI/Configuration/Value/Constant.php @@ -14,10 +14,10 @@ * * @psalm-immutable */ -final class Constant +final readonly class Constant { - private readonly string $name; - private readonly bool|string $value; + private string $name; + private bool|string $value; public function __construct(string $name, bool|string $value) { @@ -30,7 +30,7 @@ public function name(): string return $this->name; } - public function value(): mixed + public function value(): bool|string { return $this->value; } diff --git a/src/TextUI/Configuration/Value/ConstantCollection.php b/src/TextUI/Configuration/Value/ConstantCollection.php index f93ab5f2e9b..653b82892ca 100644 --- a/src/TextUI/Configuration/Value/ConstantCollection.php +++ b/src/TextUI/Configuration/Value/ConstantCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class ConstantCollection implements Countable, IteratorAggregate +final readonly class ConstantCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $constants; + private array $constants; /** * @psalm-param list $constants diff --git a/src/TextUI/Configuration/Value/Directory.php b/src/TextUI/Configuration/Value/Directory.php index 4158b656b6c..b40b2d7adcb 100644 --- a/src/TextUI/Configuration/Value/Directory.php +++ b/src/TextUI/Configuration/Value/Directory.php @@ -14,9 +14,9 @@ * * @psalm-immutable */ -final class Directory +final readonly class Directory { - private readonly string $path; + private string $path; public function __construct(string $path) { diff --git a/src/TextUI/Configuration/Value/DirectoryCollection.php b/src/TextUI/Configuration/Value/DirectoryCollection.php index 618adcc12e7..8ff890ff82b 100644 --- a/src/TextUI/Configuration/Value/DirectoryCollection.php +++ b/src/TextUI/Configuration/Value/DirectoryCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class DirectoryCollection implements Countable, IteratorAggregate +final readonly class DirectoryCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $directories; + private array $directories; /** * @psalm-param list $directories diff --git a/src/TextUI/Configuration/Value/ExtensionBootstrap.php b/src/TextUI/Configuration/Value/ExtensionBootstrap.php index c6893422398..959fbbfe6a1 100644 --- a/src/TextUI/Configuration/Value/ExtensionBootstrap.php +++ b/src/TextUI/Configuration/Value/ExtensionBootstrap.php @@ -14,17 +14,17 @@ * * @psalm-immutable */ -final class ExtensionBootstrap +final readonly class ExtensionBootstrap { /** * @psalm-var class-string */ - private readonly string $className; + private string $className; /** * @psalm-var array */ - private readonly array $parameters; + private array $parameters; /** * @psalm-param class-string $className diff --git a/src/TextUI/Configuration/Value/ExtensionBootstrapCollection.php b/src/TextUI/Configuration/Value/ExtensionBootstrapCollection.php index 2a144378273..5a105211c2c 100644 --- a/src/TextUI/Configuration/Value/ExtensionBootstrapCollection.php +++ b/src/TextUI/Configuration/Value/ExtensionBootstrapCollection.php @@ -18,12 +18,12 @@ * * @psalm-immutable */ -final class ExtensionBootstrapCollection implements IteratorAggregate +final readonly class ExtensionBootstrapCollection implements IteratorAggregate { /** * @psalm-var list */ - private readonly array $extensionBootstraps; + private array $extensionBootstraps; /** * @psalm-param list $extensionBootstraps diff --git a/src/TextUI/Configuration/Value/File.php b/src/TextUI/Configuration/Value/File.php index 035b9a350f4..fcaebed9c09 100644 --- a/src/TextUI/Configuration/Value/File.php +++ b/src/TextUI/Configuration/Value/File.php @@ -14,12 +14,12 @@ * * @psalm-immutable */ -final class File +final readonly class File { /** * @psalm-var non-empty-string */ - private readonly string $path; + private string $path; /** * @psalm-param non-empty-string $path diff --git a/src/TextUI/Configuration/Value/FileCollection.php b/src/TextUI/Configuration/Value/FileCollection.php index ee730aaa5aa..342394c7f00 100644 --- a/src/TextUI/Configuration/Value/FileCollection.php +++ b/src/TextUI/Configuration/Value/FileCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class FileCollection implements Countable, IteratorAggregate +final readonly class FileCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $files; + private array $files; /** * @psalm-param list $files diff --git a/src/TextUI/Configuration/Value/FilterDirectory.php b/src/TextUI/Configuration/Value/FilterDirectory.php index d66f951109e..fcae361721c 100644 --- a/src/TextUI/Configuration/Value/FilterDirectory.php +++ b/src/TextUI/Configuration/Value/FilterDirectory.php @@ -14,14 +14,14 @@ * * @psalm-immutable */ -final class FilterDirectory +final readonly class FilterDirectory { /** * @psalm-var non-empty-string */ - private readonly string $path; - private readonly string $prefix; - private readonly string $suffix; + private string $path; + private string $prefix; + private string $suffix; /** * @psalm-param non-empty-string $path diff --git a/src/TextUI/Configuration/Value/FilterDirectoryCollection.php b/src/TextUI/Configuration/Value/FilterDirectoryCollection.php index 53b474d8a99..232c5d24d5e 100644 --- a/src/TextUI/Configuration/Value/FilterDirectoryCollection.php +++ b/src/TextUI/Configuration/Value/FilterDirectoryCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class FilterDirectoryCollection implements Countable, IteratorAggregate +final readonly class FilterDirectoryCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $directories; + private array $directories; /** * @psalm-param list $directories diff --git a/src/TextUI/Configuration/Value/Group.php b/src/TextUI/Configuration/Value/Group.php index 1ee1baacb47..d60a7de29c6 100644 --- a/src/TextUI/Configuration/Value/Group.php +++ b/src/TextUI/Configuration/Value/Group.php @@ -14,9 +14,9 @@ * * @psalm-immutable */ -final class Group +final readonly class Group { - private readonly string $name; + private string $name; public function __construct(string $name) { diff --git a/src/TextUI/Configuration/Value/GroupCollection.php b/src/TextUI/Configuration/Value/GroupCollection.php index eb581de5916..0787f1f9672 100644 --- a/src/TextUI/Configuration/Value/GroupCollection.php +++ b/src/TextUI/Configuration/Value/GroupCollection.php @@ -18,12 +18,12 @@ * * @template-implements IteratorAggregate */ -final class GroupCollection implements IteratorAggregate +final readonly class GroupCollection implements IteratorAggregate { /** * @psalm-var list */ - private readonly array $groups; + private array $groups; /** * @psalm-param list $groups diff --git a/src/TextUI/Configuration/Value/IniSetting.php b/src/TextUI/Configuration/Value/IniSetting.php index aa88d731840..b7539f981ad 100644 --- a/src/TextUI/Configuration/Value/IniSetting.php +++ b/src/TextUI/Configuration/Value/IniSetting.php @@ -14,10 +14,10 @@ * * @psalm-immutable */ -final class IniSetting +final readonly class IniSetting { - private readonly string $name; - private readonly string $value; + private string $name; + private string $value; public function __construct(string $name, string $value) { diff --git a/src/TextUI/Configuration/Value/IniSettingCollection.php b/src/TextUI/Configuration/Value/IniSettingCollection.php index 2d405b4afbc..4ab61027787 100644 --- a/src/TextUI/Configuration/Value/IniSettingCollection.php +++ b/src/TextUI/Configuration/Value/IniSettingCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class IniSettingCollection implements Countable, IteratorAggregate +final readonly class IniSettingCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $iniSettings; + private array $iniSettings; /** * @psalm-param list $iniSettings diff --git a/src/TextUI/Configuration/Value/Php.php b/src/TextUI/Configuration/Value/Php.php index 17d0848423f..19654ebef5c 100644 --- a/src/TextUI/Configuration/Value/Php.php +++ b/src/TextUI/Configuration/Value/Php.php @@ -14,19 +14,19 @@ * * @psalm-immutable */ -final class Php +final readonly class Php { - private readonly DirectoryCollection $includePaths; - private readonly IniSettingCollection $iniSettings; - private readonly ConstantCollection $constants; - private readonly VariableCollection $globalVariables; - private readonly VariableCollection $envVariables; - private readonly VariableCollection $postVariables; - private readonly VariableCollection $getVariables; - private readonly VariableCollection $cookieVariables; - private readonly VariableCollection $serverVariables; - private readonly VariableCollection $filesVariables; - private readonly VariableCollection $requestVariables; + private DirectoryCollection $includePaths; + private IniSettingCollection $iniSettings; + private ConstantCollection $constants; + private VariableCollection $globalVariables; + private VariableCollection $envVariables; + private VariableCollection $postVariables; + private VariableCollection $getVariables; + private VariableCollection $cookieVariables; + private VariableCollection $serverVariables; + private VariableCollection $filesVariables; + private VariableCollection $requestVariables; public function __construct(DirectoryCollection $includePaths, IniSettingCollection $iniSettings, ConstantCollection $constants, VariableCollection $globalVariables, VariableCollection $envVariables, VariableCollection $postVariables, VariableCollection $getVariables, VariableCollection $cookieVariables, VariableCollection $serverVariables, VariableCollection $filesVariables, VariableCollection $requestVariables) { diff --git a/src/TextUI/Configuration/Value/Source.php b/src/TextUI/Configuration/Value/Source.php index b22edba8508..a13eccec4ec 100644 --- a/src/TextUI/Configuration/Value/Source.php +++ b/src/TextUI/Configuration/Value/Source.php @@ -14,27 +14,27 @@ * * @psalm-immutable */ -final class Source +final readonly class Source { /** * @psalm-var non-empty-string */ - private readonly ?string $baseline; - private readonly bool $ignoreBaseline; - private readonly FilterDirectoryCollection $includeDirectories; - private readonly FileCollection $includeFiles; - private readonly FilterDirectoryCollection $excludeDirectories; - private readonly FileCollection $excludeFiles; - private readonly bool $restrictDeprecations; - private readonly bool $restrictNotices; - private readonly bool $restrictWarnings; - private readonly bool $ignoreSuppressionOfDeprecations; - private readonly bool $ignoreSuppressionOfPhpDeprecations; - private readonly bool $ignoreSuppressionOfErrors; - private readonly bool $ignoreSuppressionOfNotices; - private readonly bool $ignoreSuppressionOfPhpNotices; - private readonly bool $ignoreSuppressionOfWarnings; - private readonly bool $ignoreSuppressionOfPhpWarnings; + private ?string $baseline; + private bool $ignoreBaseline; + private FilterDirectoryCollection $includeDirectories; + private FileCollection $includeFiles; + private FilterDirectoryCollection $excludeDirectories; + private FileCollection $excludeFiles; + private bool $restrictDeprecations; + private bool $restrictNotices; + private bool $restrictWarnings; + private bool $ignoreSuppressionOfDeprecations; + private bool $ignoreSuppressionOfPhpDeprecations; + private bool $ignoreSuppressionOfErrors; + private bool $ignoreSuppressionOfNotices; + private bool $ignoreSuppressionOfPhpNotices; + private bool $ignoreSuppressionOfWarnings; + private bool $ignoreSuppressionOfPhpWarnings; /** * @psalm-param non-empty-string $baseline diff --git a/src/TextUI/Configuration/Value/TestDirectory.php b/src/TextUI/Configuration/Value/TestDirectory.php index d19e8859e36..f4671c3ed12 100644 --- a/src/TextUI/Configuration/Value/TestDirectory.php +++ b/src/TextUI/Configuration/Value/TestDirectory.php @@ -16,16 +16,16 @@ * * @psalm-immutable */ -final class TestDirectory +final readonly class TestDirectory { /** * @psalm-var non-empty-string */ - private readonly string $path; - private readonly string $prefix; - private readonly string $suffix; - private readonly string $phpVersion; - private readonly VersionComparisonOperator $phpVersionOperator; + private string $path; + private string $prefix; + private string $suffix; + private string $phpVersion; + private VersionComparisonOperator $phpVersionOperator; /** * @psalm-param non-empty-string $path diff --git a/src/TextUI/Configuration/Value/TestDirectoryCollection.php b/src/TextUI/Configuration/Value/TestDirectoryCollection.php index a3667a8e0c0..9048370c8be 100644 --- a/src/TextUI/Configuration/Value/TestDirectoryCollection.php +++ b/src/TextUI/Configuration/Value/TestDirectoryCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class TestDirectoryCollection implements Countable, IteratorAggregate +final readonly class TestDirectoryCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $directories; + private array $directories; /** * @psalm-param list $directories diff --git a/src/TextUI/Configuration/Value/TestFile.php b/src/TextUI/Configuration/Value/TestFile.php index f0a8101066f..edc757b4356 100644 --- a/src/TextUI/Configuration/Value/TestFile.php +++ b/src/TextUI/Configuration/Value/TestFile.php @@ -16,11 +16,11 @@ * * @psalm-immutable */ -final class TestFile +final readonly class TestFile { - private readonly string $path; - private readonly string $phpVersion; - private readonly VersionComparisonOperator $phpVersionOperator; + private string $path; + private string $phpVersion; + private VersionComparisonOperator $phpVersionOperator; public function __construct(string $path, string $phpVersion, VersionComparisonOperator $phpVersionOperator) { diff --git a/src/TextUI/Configuration/Value/TestFileCollection.php b/src/TextUI/Configuration/Value/TestFileCollection.php index 4582664b40a..fcb30a3c60a 100644 --- a/src/TextUI/Configuration/Value/TestFileCollection.php +++ b/src/TextUI/Configuration/Value/TestFileCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class TestFileCollection implements Countable, IteratorAggregate +final readonly class TestFileCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $files; + private array $files; /** * @psalm-param list $files diff --git a/src/TextUI/Configuration/Value/TestSuite.php b/src/TextUI/Configuration/Value/TestSuite.php index 7105242bf9d..17a158c2592 100644 --- a/src/TextUI/Configuration/Value/TestSuite.php +++ b/src/TextUI/Configuration/Value/TestSuite.php @@ -14,15 +14,15 @@ * * @psalm-immutable */ -final class TestSuite +final readonly class TestSuite { /** * @psalm-var non-empty-string */ - private readonly string $name; - private readonly TestDirectoryCollection $directories; - private readonly TestFileCollection $files; - private readonly FileCollection $exclude; + private string $name; + private TestDirectoryCollection $directories; + private TestFileCollection $files; + private FileCollection $exclude; /** * @psalm-param non-empty-string $name diff --git a/src/TextUI/Configuration/Value/TestSuiteCollection.php b/src/TextUI/Configuration/Value/TestSuiteCollection.php index 493ef0aa9fb..ab4a1b329d6 100644 --- a/src/TextUI/Configuration/Value/TestSuiteCollection.php +++ b/src/TextUI/Configuration/Value/TestSuiteCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class TestSuiteCollection implements Countable, IteratorAggregate +final readonly class TestSuiteCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $testSuites; + private array $testSuites; /** * @psalm-param list $testSuites diff --git a/src/TextUI/Configuration/Value/Variable.php b/src/TextUI/Configuration/Value/Variable.php index edf41d94d87..97d931074c4 100644 --- a/src/TextUI/Configuration/Value/Variable.php +++ b/src/TextUI/Configuration/Value/Variable.php @@ -14,11 +14,11 @@ * * @psalm-immutable */ -final class Variable +final readonly class Variable { - private readonly string $name; - private readonly mixed $value; - private readonly bool $force; + private string $name; + private mixed $value; + private bool $force; public function __construct(string $name, mixed $value, bool $force) { diff --git a/src/TextUI/Configuration/Value/VariableCollection.php b/src/TextUI/Configuration/Value/VariableCollection.php index 9c3dc459c99..3b7b9176d65 100644 --- a/src/TextUI/Configuration/Value/VariableCollection.php +++ b/src/TextUI/Configuration/Value/VariableCollection.php @@ -20,12 +20,12 @@ * * @template-implements IteratorAggregate */ -final class VariableCollection implements Countable, IteratorAggregate +final readonly class VariableCollection implements Countable, IteratorAggregate { /** * @psalm-var list */ - private readonly array $variables; + private array $variables; /** * @psalm-param list $variables diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/CodeCoverage.php b/src/TextUI/Configuration/Xml/CodeCoverage/CodeCoverage.php index b38feefc731..47b31daa0a3 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/CodeCoverage.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/CodeCoverage.php @@ -9,10 +9,6 @@ */ namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage; -use function count; -use PHPUnit\TextUI\Configuration\Directory; -use PHPUnit\TextUI\Configuration\FileCollection; -use PHPUnit\TextUI\Configuration\FilterDirectoryCollection; use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Clover; use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Cobertura; use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Crap4j; @@ -27,32 +23,22 @@ * * @psalm-immutable */ -final class CodeCoverage +final readonly class CodeCoverage { - private readonly ?Directory $cacheDirectory; - private readonly FilterDirectoryCollection $directories; - private readonly FileCollection $files; - private readonly FilterDirectoryCollection $excludeDirectories; - private readonly FileCollection $excludeFiles; - private readonly bool $pathCoverage; - private readonly bool $includeUncoveredFiles; - private readonly bool $ignoreDeprecatedCodeUnits; - private readonly bool $disableCodeCoverageIgnore; - private readonly ?Clover $clover; - private readonly ?Cobertura $cobertura; - private readonly ?Crap4j $crap4j; - private readonly ?Html $html; - private readonly ?Php $php; - private readonly ?Text $text; - private readonly ?Xml $xml; - - public function __construct(?Directory $cacheDirectory, FilterDirectoryCollection $directories, FileCollection $files, FilterDirectoryCollection $excludeDirectories, FileCollection $excludeFiles, bool $pathCoverage, bool $includeUncoveredFiles, bool $ignoreDeprecatedCodeUnits, bool $disableCodeCoverageIgnore, ?Clover $clover, ?Cobertura $cobertura, ?Crap4j $crap4j, ?Html $html, ?Php $php, ?Text $text, ?Xml $xml) + private bool $pathCoverage; + private bool $includeUncoveredFiles; + private bool $ignoreDeprecatedCodeUnits; + private bool $disableCodeCoverageIgnore; + private ?Clover $clover; + private ?Cobertura $cobertura; + private ?Crap4j $crap4j; + private ?Html $html; + private ?Php $php; + private ?Text $text; + private ?Xml $xml; + + public function __construct(bool $pathCoverage, bool $includeUncoveredFiles, bool $ignoreDeprecatedCodeUnits, bool $disableCodeCoverageIgnore, ?Clover $clover, ?Cobertura $cobertura, ?Crap4j $crap4j, ?Html $html, ?Php $php, ?Text $text, ?Xml $xml) { - $this->cacheDirectory = $cacheDirectory; - $this->directories = $directories; - $this->files = $files; - $this->excludeDirectories = $excludeDirectories; - $this->excludeFiles = $excludeFiles; $this->pathCoverage = $pathCoverage; $this->includeUncoveredFiles = $includeUncoveredFiles; $this->ignoreDeprecatedCodeUnits = $ignoreDeprecatedCodeUnits; @@ -66,57 +52,6 @@ public function __construct(?Directory $cacheDirectory, FilterDirectoryCollectio $this->xml = $xml; } - /** - * @psalm-assert-if-true !null $this->cacheDirectory - * - * @deprecated - */ - public function hasCacheDirectory(): bool - { - return $this->cacheDirectory !== null; - } - - /** - * @throws Exception - * - * @deprecated - */ - public function cacheDirectory(): Directory - { - if (!$this->hasCacheDirectory()) { - throw new Exception( - 'No cache directory has been configured', - ); - } - - return $this->cacheDirectory; - } - - public function hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport(): bool - { - return count($this->directories) > 0 || count($this->files) > 0; - } - - public function directories(): FilterDirectoryCollection - { - return $this->directories; - } - - public function files(): FileCollection - { - return $this->files; - } - - public function excludeDirectories(): FilterDirectoryCollection - { - return $this->excludeDirectories; - } - - public function excludeFiles(): FileCollection - { - return $this->excludeFiles; - } - public function pathCoverage(): bool { return $this->pathCoverage; diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Clover.php b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Clover.php index 0d59cef58e7..dd5ca28d7d1 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Clover.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Clover.php @@ -16,9 +16,9 @@ * * @psalm-immutable */ -final class Clover +final readonly class Clover { - private readonly File $target; + private File $target; public function __construct(File $target) { diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Cobertura.php b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Cobertura.php index 5c15cf27ab9..19cb5dcef5e 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Cobertura.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Cobertura.php @@ -16,9 +16,9 @@ * * @psalm-immutable */ -final class Cobertura +final readonly class Cobertura { - private readonly File $target; + private File $target; public function __construct(File $target) { diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Crap4j.php b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Crap4j.php index 3e292df3f9e..47ab2a81589 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Crap4j.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Crap4j.php @@ -16,10 +16,10 @@ * * @psalm-immutable */ -final class Crap4j +final readonly class Crap4j { - private readonly File $target; - private readonly int $threshold; + private File $target; + private int $threshold; public function __construct(File $target, int $threshold) { diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php index 8a5841d23b9..91605b8fa81 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php @@ -17,17 +17,17 @@ * * @psalm-immutable */ -final class Html +final readonly class Html { - private readonly Directory $target; - private readonly int $lowUpperBound; - private readonly int $highLowerBound; - private readonly string $colorSuccessLow; - private readonly string $colorSuccessMedium; - private readonly string $colorSuccessHigh; - private readonly string $colorWarning; - private readonly string $colorDanger; - private readonly ?string $customCssFile; + private Directory $target; + private int $lowUpperBound; + private int $highLowerBound; + private string $colorSuccessLow; + private string $colorSuccessMedium; + private string $colorSuccessHigh; + private string $colorWarning; + private string $colorDanger; + private ?string $customCssFile; public function __construct(Directory $target, int $lowUpperBound, int $highLowerBound, string $colorSuccessLow, string $colorSuccessMedium, string $colorSuccessHigh, string $colorWarning, string $colorDanger, ?string $customCssFile) { diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Php.php b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Php.php index 121287a196a..91c18333917 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Php.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Php.php @@ -16,9 +16,9 @@ * * @psalm-immutable */ -final class Php +final readonly class Php { - private readonly File $target; + private File $target; public function __construct(File $target) { diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Text.php b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Text.php index 749c32cffb6..4c4a3b8504a 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Text.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Text.php @@ -16,11 +16,11 @@ * * @psalm-immutable */ -final class Text +final readonly class Text { - private readonly File $target; - private readonly bool $showUncoveredFiles; - private readonly bool $showOnlySummary; + private File $target; + private bool $showUncoveredFiles; + private bool $showOnlySummary; public function __construct(File $target, bool $showUncoveredFiles, bool $showOnlySummary) { diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Xml.php b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Xml.php index 2f891e972e8..581f0efcd9c 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Xml.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Xml.php @@ -16,9 +16,9 @@ * * @psalm-immutable */ -final class Xml +final readonly class Xml { - private readonly Directory $target; + private Directory $target; public function __construct(Directory $target) { diff --git a/src/TextUI/Configuration/Xml/DefaultConfiguration.php b/src/TextUI/Configuration/Xml/DefaultConfiguration.php index 5c652e95b32..3f44fbbeac9 100644 --- a/src/TextUI/Configuration/Xml/DefaultConfiguration.php +++ b/src/TextUI/Configuration/Xml/DefaultConfiguration.php @@ -54,11 +54,6 @@ public static function create(): self false, ), new CodeCoverage( - null, - CodeCoverageFilterDirectoryCollection::fromArray([]), - FileCollection::fromArray([]), - CodeCoverageFilterDirectoryCollection::fromArray([]), - FileCollection::fromArray([]), false, true, false, @@ -97,7 +92,6 @@ public static function create(): self new PHPUnit( null, true, - null, 80, \PHPUnit\TextUI\Configuration\Configuration::COLOR_DEFAULT, false, diff --git a/src/TextUI/Configuration/Xml/Groups.php b/src/TextUI/Configuration/Xml/Groups.php index e8f61b5e667..b51d7504b7f 100644 --- a/src/TextUI/Configuration/Xml/Groups.php +++ b/src/TextUI/Configuration/Xml/Groups.php @@ -16,10 +16,10 @@ * * @psalm-immutable */ -final class Groups +final readonly class Groups { - private readonly GroupCollection $include; - private readonly GroupCollection $exclude; + private GroupCollection $include; + private GroupCollection $exclude; public function __construct(GroupCollection $include, GroupCollection $exclude) { diff --git a/src/TextUI/Configuration/Xml/Loader.php b/src/TextUI/Configuration/Xml/Loader.php index 2c219292fb5..1871cc00cdb 100644 --- a/src/TextUI/Configuration/Xml/Loader.php +++ b/src/TextUI/Configuration/Xml/Loader.php @@ -299,7 +299,6 @@ private function source(string $filename, DOMXPath $xpath): Source private function codeCoverage(string $filename, DOMXPath $xpath): CodeCoverage { - $cacheDirectory = null; $pathCoverage = false; $includeUncoveredFiles = true; $ignoreDeprecatedCodeUnits = false; @@ -308,14 +307,6 @@ private function codeCoverage(string $filename, DOMXPath $xpath): CodeCoverage $element = $this->element($xpath, 'coverage'); if ($element) { - $cacheDirectory = $this->getStringAttribute($element, 'cacheDirectory'); - - if ($cacheDirectory !== null) { - $cacheDirectory = new Directory( - $this->toAbsolutePath($filename, $cacheDirectory), - ); - } - $pathCoverage = $this->getBooleanAttribute( $element, 'pathCoverage', @@ -454,11 +445,6 @@ private function codeCoverage(string $filename, DOMXPath $xpath): CodeCoverage } return new CodeCoverage( - $cacheDirectory, - $this->readFilterDirectories($filename, $xpath, 'coverage/include/directory'), - $this->readFilterFiles($filename, $xpath, 'coverage/include/file'), - $this->readFilterDirectories($filename, $xpath, 'coverage/exclude/directory'), - $this->readFilterFiles($filename, $xpath, 'coverage/exclude/file'), $pathCoverage, $includeUncoveredFiles, $ignoreDeprecatedCodeUnits, @@ -741,12 +727,6 @@ private function phpunit(string $filename, DOMDocument $document): PHPUnit $cacheDirectory = $this->toAbsolutePath($filename, $cacheDirectory); } - $cacheResultFile = $this->getStringAttribute($document->documentElement, 'cacheResultFile'); - - if ($cacheResultFile !== null) { - $cacheResultFile = $this->toAbsolutePath($filename, $cacheResultFile); - } - $bootstrap = $this->getStringAttribute($document->documentElement, 'bootstrap'); if ($bootstrap !== null) { @@ -763,30 +743,23 @@ private function phpunit(string $filename, DOMDocument $document): PHPUnit if ($document->documentElement->hasAttribute('backupStaticProperties')) { $backupStaticProperties = $this->getBooleanAttribute($document->documentElement, 'backupStaticProperties', false); - } elseif ($document->documentElement->hasAttribute('backupStaticAttributes')) { - $backupStaticProperties = $this->getBooleanAttribute($document->documentElement, 'backupStaticAttributes', false); } $requireCoverageMetadata = false; if ($document->documentElement->hasAttribute('requireCoverageMetadata')) { $requireCoverageMetadata = $this->getBooleanAttribute($document->documentElement, 'requireCoverageMetadata', false); - } elseif ($document->documentElement->hasAttribute('forceCoversAnnotation')) { - $requireCoverageMetadata = $this->getBooleanAttribute($document->documentElement, 'forceCoversAnnotation', false); } $beStrictAboutCoverageMetadata = false; if ($document->documentElement->hasAttribute('beStrictAboutCoverageMetadata')) { $beStrictAboutCoverageMetadata = $this->getBooleanAttribute($document->documentElement, 'beStrictAboutCoverageMetadata', false); - } elseif ($document->documentElement->hasAttribute('forceCoversAnnotation')) { - $beStrictAboutCoverageMetadata = $this->getBooleanAttribute($document->documentElement, 'beStrictAboutCoversAnnotation', false); } return new PHPUnit( $cacheDirectory, $this->getBooleanAttribute($document->documentElement, 'cacheResult', true), - $cacheResultFile, $this->getColumns($document), $this->getColors($document), $this->getBooleanAttribute($document->documentElement, 'stderr', false), diff --git a/src/TextUI/Configuration/Xml/Logging/Junit.php b/src/TextUI/Configuration/Xml/Logging/Junit.php index 020144b8903..36b24109987 100644 --- a/src/TextUI/Configuration/Xml/Logging/Junit.php +++ b/src/TextUI/Configuration/Xml/Logging/Junit.php @@ -16,9 +16,9 @@ * * @psalm-immutable */ -final class Junit +final readonly class Junit { - private readonly File $target; + private File $target; public function __construct(File $target) { diff --git a/src/TextUI/Configuration/Xml/Logging/Logging.php b/src/TextUI/Configuration/Xml/Logging/Logging.php index 587f727f82e..b2dc9af42bf 100644 --- a/src/TextUI/Configuration/Xml/Logging/Logging.php +++ b/src/TextUI/Configuration/Xml/Logging/Logging.php @@ -18,12 +18,12 @@ * * @psalm-immutable */ -final class Logging +final readonly class Logging { - private readonly ?Junit $junit; - private readonly ?TeamCity $teamCity; - private readonly ?TestDoxHtml $testDoxHtml; - private readonly ?TestDoxText $testDoxText; + private ?Junit $junit; + private ?TeamCity $teamCity; + private ?TestDoxHtml $testDoxHtml; + private ?TestDoxText $testDoxText; public function __construct(?Junit $junit, ?TeamCity $teamCity, ?TestDoxHtml $testDoxHtml, ?TestDoxText $testDoxText) { diff --git a/src/TextUI/Configuration/Xml/Logging/TeamCity.php b/src/TextUI/Configuration/Xml/Logging/TeamCity.php index 263fcf0d7f4..8c5607cf9a7 100644 --- a/src/TextUI/Configuration/Xml/Logging/TeamCity.php +++ b/src/TextUI/Configuration/Xml/Logging/TeamCity.php @@ -16,9 +16,9 @@ * * @psalm-immutable */ -final class TeamCity +final readonly class TeamCity { - private readonly File $target; + private File $target; public function __construct(File $target) { diff --git a/src/TextUI/Configuration/Xml/Logging/TestDox/Html.php b/src/TextUI/Configuration/Xml/Logging/TestDox/Html.php index 8cfb00e2a41..8d11a672365 100644 --- a/src/TextUI/Configuration/Xml/Logging/TestDox/Html.php +++ b/src/TextUI/Configuration/Xml/Logging/TestDox/Html.php @@ -16,9 +16,9 @@ * * @psalm-immutable */ -final class Html +final readonly class Html { - private readonly File $target; + private File $target; public function __construct(File $target) { diff --git a/src/TextUI/Configuration/Xml/Logging/TestDox/Text.php b/src/TextUI/Configuration/Xml/Logging/TestDox/Text.php index b91c793d1d0..1950c13e7cd 100644 --- a/src/TextUI/Configuration/Xml/Logging/TestDox/Text.php +++ b/src/TextUI/Configuration/Xml/Logging/TestDox/Text.php @@ -16,9 +16,9 @@ * * @psalm-immutable */ -final class Text +final readonly class Text { - private readonly File $target; + private File $target; public function __construct(File $target) { diff --git a/src/TextUI/Configuration/Xml/PHPUnit.php b/src/TextUI/Configuration/Xml/PHPUnit.php index 6c3ddd649e3..0626b44f058 100644 --- a/src/TextUI/Configuration/Xml/PHPUnit.php +++ b/src/TextUI/Configuration/Xml/PHPUnit.php @@ -14,73 +14,71 @@ * * @psalm-immutable */ -final class PHPUnit +final readonly class PHPUnit { - private readonly ?string $cacheDirectory; - private readonly bool $cacheResult; - private readonly ?string $cacheResultFile; - private readonly int|string $columns; - private readonly string $colors; - private readonly bool $stderr; - private readonly bool $displayDetailsOnIncompleteTests; - private readonly bool $displayDetailsOnSkippedTests; - private readonly bool $displayDetailsOnTestsThatTriggerDeprecations; - private readonly bool $displayDetailsOnTestsThatTriggerErrors; - private readonly bool $displayDetailsOnTestsThatTriggerNotices; - private readonly bool $displayDetailsOnTestsThatTriggerWarnings; - private readonly bool $reverseDefectList; - private readonly bool $requireCoverageMetadata; - private readonly ?string $bootstrap; - private readonly bool $processIsolation; - private readonly bool $failOnDeprecation; - private readonly bool $failOnEmptyTestSuite; - private readonly bool $failOnIncomplete; - private readonly bool $failOnNotice; - private readonly bool $failOnRisky; - private readonly bool $failOnSkipped; - private readonly bool $failOnWarning; - private readonly bool $stopOnDefect; - private readonly bool $stopOnDeprecation; - private readonly bool $stopOnError; - private readonly bool $stopOnFailure; - private readonly bool $stopOnIncomplete; - private readonly bool $stopOnNotice; - private readonly bool $stopOnRisky; - private readonly bool $stopOnSkipped; - private readonly bool $stopOnWarning; + private ?string $cacheDirectory; + private bool $cacheResult; + private int|string $columns; + private string $colors; + private bool $stderr; + private bool $displayDetailsOnIncompleteTests; + private bool $displayDetailsOnSkippedTests; + private bool $displayDetailsOnTestsThatTriggerDeprecations; + private bool $displayDetailsOnTestsThatTriggerErrors; + private bool $displayDetailsOnTestsThatTriggerNotices; + private bool $displayDetailsOnTestsThatTriggerWarnings; + private bool $reverseDefectList; + private bool $requireCoverageMetadata; + private ?string $bootstrap; + private bool $processIsolation; + private bool $failOnDeprecation; + private bool $failOnEmptyTestSuite; + private bool $failOnIncomplete; + private bool $failOnNotice; + private bool $failOnRisky; + private bool $failOnSkipped; + private bool $failOnWarning; + private bool $stopOnDefect; + private bool $stopOnDeprecation; + private bool $stopOnError; + private bool $stopOnFailure; + private bool $stopOnIncomplete; + private bool $stopOnNotice; + private bool $stopOnRisky; + private bool $stopOnSkipped; + private bool $stopOnWarning; /** * @psalm-var ?non-empty-string */ - private readonly ?string $extensionsDirectory; - private readonly bool $beStrictAboutChangesToGlobalState; - private readonly bool $beStrictAboutOutputDuringTests; - private readonly bool $beStrictAboutTestsThatDoNotTestAnything; - private readonly bool $beStrictAboutCoverageMetadata; - private readonly bool $enforceTimeLimit; - private readonly int $defaultTimeLimit; - private readonly int $timeoutForSmallTests; - private readonly int $timeoutForMediumTests; - private readonly int $timeoutForLargeTests; - private readonly ?string $defaultTestSuite; - private readonly int $executionOrder; - private readonly bool $resolveDependencies; - private readonly bool $defectsFirst; - private readonly bool $backupGlobals; - private readonly bool $backupStaticProperties; - private readonly bool $registerMockObjectsFromTestArgumentsRecursively; - private readonly bool $testdoxPrinter; - private readonly bool $controlGarbageCollector; - private readonly int $numberOfTestsBeforeGarbageCollection; + private ?string $extensionsDirectory; + private bool $beStrictAboutChangesToGlobalState; + private bool $beStrictAboutOutputDuringTests; + private bool $beStrictAboutTestsThatDoNotTestAnything; + private bool $beStrictAboutCoverageMetadata; + private bool $enforceTimeLimit; + private int $defaultTimeLimit; + private int $timeoutForSmallTests; + private int $timeoutForMediumTests; + private int $timeoutForLargeTests; + private ?string $defaultTestSuite; + private int $executionOrder; + private bool $resolveDependencies; + private bool $defectsFirst; + private bool $backupGlobals; + private bool $backupStaticProperties; + private bool $registerMockObjectsFromTestArgumentsRecursively; + private bool $testdoxPrinter; + private bool $controlGarbageCollector; + private int $numberOfTestsBeforeGarbageCollection; /** * @psalm-param ?non-empty-string $extensionsDirectory */ - public function __construct(?string $cacheDirectory, bool $cacheResult, ?string $cacheResultFile, int|string $columns, string $colors, bool $stderr, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, ?string $bootstrap, bool $processIsolation, bool $failOnDeprecation, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $stopOnDefect, bool $stopOnDeprecation, bool $stopOnError, bool $stopOnFailure, bool $stopOnIncomplete, bool $stopOnNotice, bool $stopOnRisky, bool $stopOnSkipped, bool $stopOnWarning, ?string $extensionsDirectory, bool $beStrictAboutChangesToGlobalState, bool $beStrictAboutOutputDuringTests, bool $beStrictAboutTestsThatDoNotTestAnything, bool $beStrictAboutCoverageMetadata, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, ?string $defaultTestSuite, int $executionOrder, bool $resolveDependencies, bool $defectsFirst, bool $backupGlobals, bool $backupStaticProperties, bool $registerMockObjectsFromTestArgumentsRecursively, bool $testdoxPrinter, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection) + public function __construct(?string $cacheDirectory, bool $cacheResult, int|string $columns, string $colors, bool $stderr, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, ?string $bootstrap, bool $processIsolation, bool $failOnDeprecation, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $stopOnDefect, bool $stopOnDeprecation, bool $stopOnError, bool $stopOnFailure, bool $stopOnIncomplete, bool $stopOnNotice, bool $stopOnRisky, bool $stopOnSkipped, bool $stopOnWarning, ?string $extensionsDirectory, bool $beStrictAboutChangesToGlobalState, bool $beStrictAboutOutputDuringTests, bool $beStrictAboutTestsThatDoNotTestAnything, bool $beStrictAboutCoverageMetadata, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, ?string $defaultTestSuite, int $executionOrder, bool $resolveDependencies, bool $defectsFirst, bool $backupGlobals, bool $backupStaticProperties, bool $registerMockObjectsFromTestArgumentsRecursively, bool $testdoxPrinter, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection) { $this->cacheDirectory = $cacheDirectory; $this->cacheResult = $cacheResult; - $this->cacheResultFile = $cacheResultFile; $this->columns = $columns; $this->colors = $colors; $this->stderr = $stderr; @@ -157,30 +155,6 @@ public function cacheResult(): bool return $this->cacheResult; } - /** - * @psalm-assert-if-true !null $this->cacheResultFile - * - * @deprecated - */ - public function hasCacheResultFile(): bool - { - return $this->cacheResultFile !== null; - } - - /** - * @throws Exception - * - * @deprecated - */ - public function cacheResultFile(): string - { - if (!$this->hasCacheResultFile()) { - throw new Exception('Cache result file is not configured'); - } - - return $this->cacheResultFile; - } - public function columns(): int|string { return $this->columns; diff --git a/src/TextUI/Configuration/Xml/Validator/ValidationResult.php b/src/TextUI/Configuration/Xml/Validator/ValidationResult.php index fc4a0ee2e28..212725e6f3f 100644 --- a/src/TextUI/Configuration/Xml/Validator/ValidationResult.php +++ b/src/TextUI/Configuration/Xml/Validator/ValidationResult.php @@ -17,12 +17,12 @@ * * @psalm-immutable */ -final class ValidationResult +final readonly class ValidationResult { /** * @psalm-var array> */ - private readonly array $validationErrors; + private array $validationErrors; /** * @psalm-param array $errors diff --git a/src/TextUI/Output/Default/ProgressPrinter/ProgressPrinter.php b/src/TextUI/Output/Default/ProgressPrinter/ProgressPrinter.php index f94f078edbd..0300147725b 100644 --- a/src/TextUI/Output/Default/ProgressPrinter/ProgressPrinter.php +++ b/src/TextUI/Output/Default/ProgressPrinter/ProgressPrinter.php @@ -135,7 +135,7 @@ public function testTriggeredPhpNotice(PhpNoticeTriggered $event): void public function testTriggeredDeprecation(DeprecationTriggered $event): void { - if ($event->ignoredByBaseline()) { + if ($event->ignoredByBaseline() || $event->ignoredByTest()) { return; } @@ -153,7 +153,7 @@ public function testTriggeredDeprecation(DeprecationTriggered $event): void public function testTriggeredPhpDeprecation(PhpDeprecationTriggered $event): void { - if ($event->ignoredByBaseline()) { + if ($event->ignoredByBaseline() || $event->ignoredByTest()) { return; } diff --git a/src/TextUI/Output/Default/UnexpectedOutputPrinter.php b/src/TextUI/Output/Default/UnexpectedOutputPrinter.php index 08c72d9b440..af669906c18 100644 --- a/src/TextUI/Output/Default/UnexpectedOutputPrinter.php +++ b/src/TextUI/Output/Default/UnexpectedOutputPrinter.php @@ -16,9 +16,9 @@ use PHPUnit\Event\UnknownSubscriberTypeException; use PHPUnit\TextUI\Output\Printer; -final class UnexpectedOutputPrinter implements PrintedUnexpectedOutputSubscriber +final readonly class UnexpectedOutputPrinter implements PrintedUnexpectedOutputSubscriber { - private readonly Printer $printer; + private Printer $printer; /** * @throws EventFacadeIsSealedException diff --git a/src/TextUI/Output/TestDox/ResultPrinter.php b/src/TextUI/Output/TestDox/ResultPrinter.php index d82d04df3fa..305c0f22da4 100644 --- a/src/TextUI/Output/TestDox/ResultPrinter.php +++ b/src/TextUI/Output/TestDox/ResultPrinter.php @@ -30,10 +30,10 @@ /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class ResultPrinter +final readonly class ResultPrinter { - private readonly Printer $printer; - private readonly bool $colors; + private Printer $printer; + private bool $colors; public function __construct(Printer $printer, bool $colors) { diff --git a/src/Util/PHP/AbstractPhpProcess.php b/src/Util/PHP/AbstractPhpProcess.php index 7223d695632..1a7b5a9d7a3 100644 --- a/src/Util/PHP/AbstractPhpProcess.php +++ b/src/Util/PHP/AbstractPhpProcess.php @@ -27,7 +27,6 @@ use PHPUnit\Event\Code\ThrowableBuilder; use PHPUnit\Event\Facade; use PHPUnit\Event\NoPreviousThrowableException; -use PHPUnit\Event\TestData\MoreThanOneDataSetFromDataProviderException; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\Exception; use PHPUnit\Framework\Test; @@ -132,7 +131,6 @@ public function getEnv(): array * * @throws \PHPUnit\Runner\Exception * @throws Exception - * @throws MoreThanOneDataSetFromDataProviderException * @throws NoPreviousThrowableException */ public function runTestJob(string $job, Test $test, string $processResultFile): void @@ -226,7 +224,6 @@ protected function settingsToParameters(array $settings): string /** * @throws \PHPUnit\Runner\Exception * @throws Exception - * @throws MoreThanOneDataSetFromDataProviderException * @throws NoPreviousThrowableException */ private function processChildResult(Test $test, string $stdout, string $stderr): void diff --git a/src/Util/VersionComparisonOperator.php b/src/Util/VersionComparisonOperator.php index ad108335eb9..a9e85513595 100644 --- a/src/Util/VersionComparisonOperator.php +++ b/src/Util/VersionComparisonOperator.php @@ -16,12 +16,12 @@ * * @psalm-immutable */ -final class VersionComparisonOperator +final readonly class VersionComparisonOperator { /** * @psalm-var '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' */ - private readonly string $operator; + private string $operator; /** * @psalm-param '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' $operator diff --git a/tests/_files/IgnoringCodeUnitsTest.php b/tests/_files/IgnoringCodeUnitsTest.php deleted file mode 100644 index 5465bbe06a8..00000000000 --- a/tests/_files/IgnoringCodeUnitsTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TestFixture; - -use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage; -use PHPUnit\Framework\Attributes\IgnoreFunctionForCodeCoverage; -use PHPUnit\Framework\Attributes\IgnoreMethodForCodeCoverage; -use PHPUnit\Framework\TestCase; - -#[IgnoreClassForCodeCoverage(CoveredParentClass::class)] -#[IgnoreMethodForCodeCoverage(CoveredClass::class, 'protectedMethod')] -#[IgnoreFunctionForCodeCoverage('globalFunction')] -final class IgnoringCodeUnitsTest extends TestCase -{ - public function testOne(): void - { - } -} diff --git a/tests/_files/Metadata/Annotation/tests/TestWithTest.php b/tests/_files/Metadata/Annotation/tests/TestWithTest.php index 04a1c287e2a..7b53d3e2e35 100644 --- a/tests/_files/Metadata/Annotation/tests/TestWithTest.php +++ b/tests/_files/Metadata/Annotation/tests/TestWithTest.php @@ -18,5 +18,6 @@ final class TestWithTest extends TestCase */ public function testOne(): void { + $this->assertTrue(true); } } diff --git a/tests/_files/Metadata/Attribute/tests/IgnoreCodeCoverageTest.php b/tests/_files/Metadata/Attribute/tests/IgnoreCodeCoverageTest.php deleted file mode 100644 index 512f83b210f..00000000000 --- a/tests/_files/Metadata/Attribute/tests/IgnoreCodeCoverageTest.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TestFixture\Metadata\Attribute; - -use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage; -use PHPUnit\Framework\Attributes\IgnoreFunctionForCodeCoverage; -use PHPUnit\Framework\Attributes\IgnoreMethodForCodeCoverage; -use PHPUnit\Framework\TestCase; - -#[IgnoreClassForCodeCoverage('className')] -#[IgnoreMethodForCodeCoverage('ClassName', 'methodName')] -#[IgnoreFunctionForCodeCoverage('functionName')] -final class IgnoreCodeCoverageTest extends TestCase -{ -} diff --git a/tests/end-to-end/code-coverage/ignore-class-using-attribute/tests/IgnoreClassForCodeCoverageTest.php b/tests/_files/Metadata/Attribute/tests/IgnoreDeprecationsClassTest.php similarity index 54% rename from tests/end-to-end/code-coverage/ignore-class-using-attribute/tests/IgnoreClassForCodeCoverageTest.php rename to tests/_files/Metadata/Attribute/tests/IgnoreDeprecationsClassTest.php index fd868f6218d..b3dc8367d02 100644 --- a/tests/end-to-end/code-coverage/ignore-class-using-attribute/tests/IgnoreClassForCodeCoverageTest.php +++ b/tests/_files/Metadata/Attribute/tests/IgnoreDeprecationsClassTest.php @@ -7,16 +7,15 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\TestFixture\IgnoreClassUsingAttribute; +namespace PHPUnit\TestFixture\Metadata\Attribute; -use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage; +use PHPUnit\Framework\Attributes\IgnoreDeprecations; use PHPUnit\Framework\TestCase; -#[IgnoreClassForCodeCoverage(CoveredClass::class)] -final class IgnoreClassForCodeCoverageTest extends TestCase +#[IgnoreDeprecations] +final class IgnoreDeprecationsClassTest extends TestCase { public function testOne(): void { - $this->assertTrue((new CoveredClass)->m()); } } diff --git a/tests/end-to-end/code-coverage/ignore-method-using-attribute/tests/IgnoreMethodForCodeCoverageTest.php b/tests/_files/Metadata/Attribute/tests/IgnoreDeprecationsMethodTest.php similarity index 53% rename from tests/end-to-end/code-coverage/ignore-method-using-attribute/tests/IgnoreMethodForCodeCoverageTest.php rename to tests/_files/Metadata/Attribute/tests/IgnoreDeprecationsMethodTest.php index 83e57a443c5..4ae80b3c490 100644 --- a/tests/end-to-end/code-coverage/ignore-method-using-attribute/tests/IgnoreMethodForCodeCoverageTest.php +++ b/tests/_files/Metadata/Attribute/tests/IgnoreDeprecationsMethodTest.php @@ -7,16 +7,15 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\TestFixture\IgnoreMethodUsingAttribute; +namespace PHPUnit\TestFixture\Metadata\Attribute; -use PHPUnit\Framework\Attributes\IgnoreMethodForCodeCoverage; +use PHPUnit\Framework\Attributes\IgnoreDeprecations; use PHPUnit\Framework\TestCase; -#[IgnoreMethodForCodeCoverage(CoveredClass::class, 'n')] -final class IgnoreMethodForCodeCoverageTest extends TestCase +final class IgnoreDeprecationsMethodTest extends TestCase { + #[IgnoreDeprecations] public function testOne(): void { - $this->assertTrue((new CoveredClass)->m()); } } diff --git a/tests/end-to-end/code-coverage/ignore-function-using-attribute/tests/IgnoreFunctionForCodeCoverageTest.php b/tests/_files/Metadata/Attribute/tests/IgnorePhpunitDeprecationsClassTest.php similarity index 52% rename from tests/end-to-end/code-coverage/ignore-function-using-attribute/tests/IgnoreFunctionForCodeCoverageTest.php rename to tests/_files/Metadata/Attribute/tests/IgnorePhpunitDeprecationsClassTest.php index e271ab2f933..1d1cf684501 100644 --- a/tests/end-to-end/code-coverage/ignore-function-using-attribute/tests/IgnoreFunctionForCodeCoverageTest.php +++ b/tests/_files/Metadata/Attribute/tests/IgnorePhpunitDeprecationsClassTest.php @@ -7,16 +7,15 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\TestFixture\IgnoreFunctionUsingAttribute; +namespace PHPUnit\TestFixture\Metadata\Attribute; -use PHPUnit\Framework\Attributes\IgnoreFunctionForCodeCoverage; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\TestCase; -#[IgnoreFunctionForCodeCoverage('PHPUnit\TestFixture\IgnoreFunctionUsingAttribute\g')] -final class IgnoreFunctionForCodeCoverageTest extends TestCase +#[IgnorePhpunitDeprecations] +final class IgnorePhpunitDeprecationsClassTest extends TestCase { public function testOne(): void { - $this->assertTrue(f()); } } diff --git a/tests/_files/Metadata/Attribute/tests/IgnorePhpunitDeprecationsMethodTest.php b/tests/_files/Metadata/Attribute/tests/IgnorePhpunitDeprecationsMethodTest.php new file mode 100644 index 00000000000..1726a374883 --- /dev/null +++ b/tests/_files/Metadata/Attribute/tests/IgnorePhpunitDeprecationsMethodTest.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Metadata\Attribute; + +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; +use PHPUnit\Framework\TestCase; + +final class IgnorePhpunitDeprecationsMethodTest extends TestCase +{ + #[IgnorePhpunitDeprecations] + public function testOne(): void + { + } +} diff --git a/tests/_files/Metadata/Attribute/tests/TestWithTest.php b/tests/_files/Metadata/Attribute/tests/TestWithTest.php index bb37a735e7e..1dc18374534 100644 --- a/tests/_files/Metadata/Attribute/tests/TestWithTest.php +++ b/tests/_files/Metadata/Attribute/tests/TestWithTest.php @@ -18,10 +18,12 @@ final class TestWithTest extends TestCase #[TestWith([1, 2, 3])] public function testOne(): void { + $this->assertTrue(true); } #[TestWithJson('[1, 2, 3]')] public function testTwo(): void { + $this->assertTrue(true); } } diff --git a/tests/_files/TestWithTest.php b/tests/_files/TestWithTest.php deleted file mode 100644 index ba7bd92aaa0..00000000000 --- a/tests/_files/TestWithTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TestFixture; - -use PHPUnit\Framework\TestCase; - -class TestWithTest extends TestCase -{ - public static function providerMethod() - { - return [ - [0, 0, 0], - [0, 1, 1], - [1, 1, 3], - [1, 0, 1], - ]; - } - - /** - * @testWith [0, 0, 0] - * [0, 1, 1] - * [1, 2, 3] - * [20, 22, 42] - */ - public function testAdd($a, $b, $c): void - { - $this->assertEquals($c, $a + $b); - } -} diff --git a/tests/_files/XmlConfigurationMigration/output-9.2.xml b/tests/_files/XmlConfigurationMigration/output-9.2.xml index 83fe8815034..8c337f01fe3 100644 --- a/tests/_files/XmlConfigurationMigration/output-9.2.xml +++ b/tests/_files/XmlConfigurationMigration/output-9.2.xml @@ -1,6 +1,6 @@ - diff --git a/tests/_files/mock-object/ExtendableClassWithCloneMethod.php b/tests/_files/mock-object/ExtendableClassWithCloneMethod.php index 83ef52c8d65..54f4c9a2cf6 100644 --- a/tests/_files/mock-object/ExtendableClassWithCloneMethod.php +++ b/tests/_files/mock-object/ExtendableClassWithCloneMethod.php @@ -21,7 +21,7 @@ public function __clone(): void throw new Exception(__METHOD__); } - public function method(): bool + public function doSomething(): bool { return true; } diff --git a/tests/end-to-end/code-coverage/ignore-class-using-attribute/src/CoveredClass.php b/tests/_files/mock-object/InterfaceWithMethodThatHasDefaultParameterValues.php similarity index 54% rename from tests/end-to-end/code-coverage/ignore-class-using-attribute/src/CoveredClass.php rename to tests/_files/mock-object/InterfaceWithMethodThatHasDefaultParameterValues.php index 4a32e5b2069..7b10933e685 100644 --- a/tests/end-to-end/code-coverage/ignore-class-using-attribute/src/CoveredClass.php +++ b/tests/_files/mock-object/InterfaceWithMethodThatHasDefaultParameterValues.php @@ -7,17 +7,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\TestFixture\IgnoreClassUsingAttribute; +namespace PHPUnit\TestFixture\MockObject; -final class CoveredClass +interface InterfaceWithMethodThatHasDefaultParameterValues { - public function m(): bool - { - return $this->n(); - } - - private function n(): bool - { - return true; - } + public function doSomething(int $a, int $b = 1): int; } diff --git a/tests/end-to-end/code-coverage/ignore-function-using-attribute/src/CoveredFunction.php b/tests/_files/mock-object/InterfaceWithNeverReturningMethod.php similarity index 65% rename from tests/end-to-end/code-coverage/ignore-function-using-attribute/src/CoveredFunction.php rename to tests/_files/mock-object/InterfaceWithNeverReturningMethod.php index d613133ba9b..7d151a486d7 100644 --- a/tests/end-to-end/code-coverage/ignore-function-using-attribute/src/CoveredFunction.php +++ b/tests/_files/mock-object/InterfaceWithNeverReturningMethod.php @@ -7,14 +7,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\TestFixture\IgnoreFunctionUsingAttribute; +namespace PHPUnit\TestFixture\MockObject; -function f(): bool +interface InterfaceWithNeverReturningMethod { - return g(); -} - -function g(): bool -{ - return true; + public function m(): never; } diff --git a/tests/_files/mock-object/TraitWithConcreteMethod.php b/tests/_files/mock-object/TraitWithConcreteMethod.php index 37f222cc2d6..bacaba177f6 100644 --- a/tests/_files/mock-object/TraitWithConcreteMethod.php +++ b/tests/_files/mock-object/TraitWithConcreteMethod.php @@ -11,7 +11,7 @@ trait TraitWithConcreteMethod { - public function method(): bool + public function doSomething(): bool { return true; } diff --git a/tests/end-to-end/_files/basic/unit/SetUpBeforeClassTest.php b/tests/end-to-end/_files/basic/unit/SetUpBeforeClassTest.php index f9355a1d61f..7cd527b419c 100644 --- a/tests/end-to-end/_files/basic/unit/SetUpBeforeClassTest.php +++ b/tests/end-to-end/_files/basic/unit/SetUpBeforeClassTest.php @@ -7,7 +7,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SelfTest\Basic; +namespace PHPUnit\TestFixture\Basic; use Exception; use PHPUnit\Framework\TestCase; diff --git a/tests/end-to-end/_files/basic/unit/SetUpTest.php b/tests/end-to-end/_files/basic/unit/SetUpTest.php index 0ce024afb5a..7c6e041497c 100644 --- a/tests/end-to-end/_files/basic/unit/SetUpTest.php +++ b/tests/end-to-end/_files/basic/unit/SetUpTest.php @@ -7,7 +7,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SelfTest\Basic; +namespace PHPUnit\TestFixture\Basic; use PHPUnit\Framework\TestCase; use RuntimeException; diff --git a/tests/end-to-end/_files/basic/unit/StatusTest.php b/tests/end-to-end/_files/basic/unit/StatusTest.php index e0857e43f25..cff05f85421 100644 --- a/tests/end-to-end/_files/basic/unit/StatusTest.php +++ b/tests/end-to-end/_files/basic/unit/StatusTest.php @@ -7,7 +7,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SelfTest\Basic; +namespace PHPUnit\TestFixture\Basic; use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; diff --git a/tests/end-to-end/_files/basic/unit/TearDownAfterClassTest.php b/tests/end-to-end/_files/basic/unit/TearDownAfterClassTest.php index 2866a85eb93..87e93d24323 100644 --- a/tests/end-to-end/_files/basic/unit/TearDownAfterClassTest.php +++ b/tests/end-to-end/_files/basic/unit/TearDownAfterClassTest.php @@ -7,7 +7,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SelfTest\Basic; +namespace PHPUnit\TestFixture\Basic; use Exception; use PHPUnit\Framework\TestCase; diff --git a/tests/end-to-end/_files/phar-extension/tools/phpunit.d/phpunit-test-extension-1.0.0.phar b/tests/end-to-end/_files/phar-extension/tools/phpunit.d/phpunit-test-extension-1.0.0.phar index f5f73240cc9..9656236231e 100644 Binary files a/tests/end-to-end/_files/phar-extension/tools/phpunit.d/phpunit-test-extension-1.0.0.phar and b/tests/end-to-end/_files/phar-extension/tools/phpunit.d/phpunit-test-extension-1.0.0.phar differ diff --git a/tests/end-to-end/cli/list-tests/list-tests-xml-dataprovider.phpt b/tests/end-to-end/cli/list-tests/list-tests-xml-dataprovider.phpt index f71393a3e23..2b55f38d923 100644 --- a/tests/end-to-end/cli/list-tests/list-tests-xml-dataprovider.phpt +++ b/tests/end-to-end/cli/list-tests/list-tests-xml-dataprovider.phpt @@ -17,9 +17,9 @@ PHPUnit %s by Sebastian Bergmann and contributors. - - - - + + + + %A diff --git a/tests/end-to-end/code-coverage/ignore-class-using-attribute-process-isolation.phpt b/tests/end-to-end/code-coverage/ignore-class-using-attribute-process-isolation.phpt deleted file mode 100644 index 77ede1da8de..00000000000 --- a/tests/end-to-end/code-coverage/ignore-class-using-attribute-process-isolation.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Classes can be ignored for code coverage using an attribute ---INI-- -pcov.directory=tests/end-to-end/code-coverage/ignore-class-using-attribute/src/ ---SKIPIF-- -run($_SERVER['argv']); ---EXPECTF-- -PHPUnit %s by Sebastian Bergmann and contributors. - -Runtime: %s - -. 1 / 1 (100%) - -Time: %s, Memory: %s MB - -OK (1 test, 1 assertion) - - -Code Coverage Report: - %s - - Summary: - Classes: (0/0) - Methods: (0/0) - Lines: (0/0) - diff --git a/tests/end-to-end/code-coverage/ignore-class-using-attribute.phpt b/tests/end-to-end/code-coverage/ignore-class-using-attribute.phpt deleted file mode 100644 index 752f03dde87..00000000000 --- a/tests/end-to-end/code-coverage/ignore-class-using-attribute.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Classes can be ignored for code coverage using an attribute ---INI-- -pcov.directory=tests/end-to-end/code-coverage/ignore-class-using-attribute/src/ ---SKIPIF-- -run($_SERVER['argv']); ---EXPECTF-- -PHPUnit %s by Sebastian Bergmann and contributors. - -Runtime: %s - -. 1 / 1 (100%) - -Time: %s, Memory: %s MB - -OK (1 test, 1 assertion) - - -Code Coverage Report: - %s - - Summary: - Classes: (0/0) - Methods: (0/0) - Lines: (0/0) - diff --git a/tests/end-to-end/code-coverage/ignore-function-using-attribute-process-isolation.phpt b/tests/end-to-end/code-coverage/ignore-function-using-attribute-process-isolation.phpt deleted file mode 100644 index e7cd5ad8932..00000000000 --- a/tests/end-to-end/code-coverage/ignore-function-using-attribute-process-isolation.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Functions can be ignored for code coverage using an attribute ---INI-- -pcov.directory=tests/end-to-end/code-coverage/ignore-function-using-attribute/src/ ---SKIPIF-- -run($_SERVER['argv']); ---EXPECTF-- -PHPUnit %s by Sebastian Bergmann and contributors. - -Runtime: %s - -. 1 / 1 (100%) - -Time: %s, Memory: %s MB - -OK (1 test, 1 assertion) - - -Code Coverage Report: - %s - - Summary: - Classes: (0/0) - Methods: (0/0) - Lines: 100.00% (1/1) - diff --git a/tests/end-to-end/code-coverage/ignore-function-using-attribute.phpt b/tests/end-to-end/code-coverage/ignore-function-using-attribute.phpt deleted file mode 100644 index 84865e10b68..00000000000 --- a/tests/end-to-end/code-coverage/ignore-function-using-attribute.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Functions can be ignored for code coverage using an attribute ---INI-- -pcov.directory=tests/end-to-end/code-coverage/ignore-function-using-attribute/src/ ---SKIPIF-- -run($_SERVER['argv']); ---EXPECTF-- -PHPUnit %s by Sebastian Bergmann and contributors. - -Runtime: %s - -. 1 / 1 (100%) - -Time: %s, Memory: %s MB - -OK (1 test, 1 assertion) - - -Code Coverage Report: - %s - - Summary: - Classes: (0/0) - Methods: (0/0) - Lines: 100.00% (1/1) - diff --git a/tests/end-to-end/code-coverage/ignore-method-using-attribute-process-isolation.phpt b/tests/end-to-end/code-coverage/ignore-method-using-attribute-process-isolation.phpt deleted file mode 100644 index c339fc1f91c..00000000000 --- a/tests/end-to-end/code-coverage/ignore-method-using-attribute-process-isolation.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -Methods can be ignored for code coverage using an attribute ---INI-- -pcov.directory=tests/end-to-end/code-coverage/ignore-method-using-attribute/src/ ---SKIPIF-- -run($_SERVER['argv']); ---EXPECTF-- -PHPUnit %s by Sebastian Bergmann and contributors. - -Runtime: %s - -. 1 / 1 (100%) - -Time: %s, Memory: %s MB - -OK (1 test, 1 assertion) - - -Code Coverage Report: - %s - - Summary: - Classes: 100.00% (1/1) - Methods: 100.00% (1/1) - Lines: 100.00% (1/1) - -PHPUnit\TestFixture\IgnoreMethodUsingAttribute\CoveredClass - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) diff --git a/tests/end-to-end/code-coverage/ignore-method-using-attribute.phpt b/tests/end-to-end/code-coverage/ignore-method-using-attribute.phpt deleted file mode 100644 index b06168952e6..00000000000 --- a/tests/end-to-end/code-coverage/ignore-method-using-attribute.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Methods can be ignored for code coverage using an attribute ---INI-- -pcov.directory=tests/end-to-end/code-coverage/ignore-method-using-attribute/src/ ---SKIPIF-- -run($_SERVER['argv']); ---EXPECTF-- -PHPUnit %s by Sebastian Bergmann and contributors. - -Runtime: %s - -. 1 / 1 (100%) - -Time: %s, Memory: %s MB - -OK (1 test, 1 assertion) - - -Code Coverage Report: - %s - - Summary: - Classes: 100.00% (1/1) - Methods: 100.00% (1/1) - Lines: 100.00% (1/1) - -PHPUnit\TestFixture\IgnoreMethodUsingAttribute\CoveredClass - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) diff --git a/tests/end-to-end/event/_files/ArgumentDataProviderTest.php b/tests/end-to-end/event/_files/ArgumentDataProviderTest.php new file mode 100644 index 00000000000..90be29e089f --- /dev/null +++ b/tests/end-to-end/event/_files/ArgumentDataProviderTest.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Event; + +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; + +final class ArgumentDataProviderTest extends TestCase +{ + public static function values(mixed $argument): array + { + return [[true], [true]]; + } + + #[DataProvider('values')] + public function testSuccess(bool $value): void + { + $this->assertTrue($value); + } +} diff --git a/tests/end-to-end/event/_files/DeprecatedPhpFeatureTest.php b/tests/end-to-end/event/_files/DeprecatedPhpFeatureTest.php index b071f002108..fbb1f8b8542 100644 --- a/tests/end-to-end/event/_files/DeprecatedPhpFeatureTest.php +++ b/tests/end-to-end/event/_files/DeprecatedPhpFeatureTest.php @@ -9,15 +9,14 @@ */ namespace PHPUnit\TestFixture\Event; -use function defined; use PHPUnit\Framework\TestCase; final class DeprecatedPhpFeatureTest extends TestCase { public function testDeprecatedPhpFeature(): void { - defined(null); - @defined(null); + @$this->foo = 'bar'; + $this->bar = 'foo'; $this->assertTrue(true); } diff --git a/tests/end-to-end/event/_files/DynamicDataProviderTest.php b/tests/end-to-end/event/_files/DynamicDataProviderTest.php new file mode 100644 index 00000000000..fa9224e2abe --- /dev/null +++ b/tests/end-to-end/event/_files/DynamicDataProviderTest.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Event; + +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; + +final class DynamicDataProviderTest extends TestCase +{ + public function values(): array + { + return [[true], [true]]; + } + + #[DataProvider('values')] + public function testSuccess(bool $value): void + { + $this->assertTrue($value); + } +} diff --git a/tests/end-to-end/event/_files/Example.php b/tests/end-to-end/event/_files/Example.php index dc534559fc6..09994df6c2a 100644 --- a/tests/end-to-end/event/_files/Example.php +++ b/tests/end-to-end/event/_files/Example.php @@ -11,5 +11,5 @@ interface Example { - public function method(): bool; + public function doSomething(): bool; } diff --git a/tests/end-to-end/event/_files/IgnoreDeprecationsTest.php b/tests/end-to-end/event/_files/IgnoreDeprecationsTest.php new file mode 100644 index 00000000000..a44c5c82d62 --- /dev/null +++ b/tests/end-to-end/event/_files/IgnoreDeprecationsTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Event; + +use function trigger_error; +use PHPUnit\Framework\Attributes\IgnoreDeprecations; +use PHPUnit\Framework\TestCase; + +final class IgnoreDeprecationsTest extends TestCase +{ + #[IgnoreDeprecations] + public function testOne(): void + { + trigger_error('message', E_USER_DEPRECATED); + + $this->assertTrue(true); + } + + public function testTwo(): void + { + trigger_error('message', E_USER_DEPRECATED); + + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/event/_files/PrivateDataProviderTest.php b/tests/end-to-end/event/_files/PrivateDataProviderTest.php new file mode 100644 index 00000000000..e5fe4e178d5 --- /dev/null +++ b/tests/end-to-end/event/_files/PrivateDataProviderTest.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Event; + +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; + +final class PrivateDataProviderTest extends TestCase +{ + #[DataProvider('values')] + public function testSuccess(bool $value): void + { + $this->assertTrue($value); + } + + private static function values(): array + { + return [[true], [true]]; + } +} diff --git a/tests/end-to-end/event/data-provider-expects-argument.phpt b/tests/end-to-end/event/data-provider-expects-argument.phpt new file mode 100644 index 00000000000..210b37c5afc --- /dev/null +++ b/tests/end-to-end/event/data-provider-expects-argument.phpt @@ -0,0 +1,43 @@ +--TEST-- +The right events are emitted in the right order for a test that uses a data provider that is not public +--SKIPIF-- +run($_SERVER['argv']); + +print file_get_contents($traceFile); + +unlink($traceFile); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Data Provider Method Called (PHPUnit\TestFixture\Event\ArgumentDataProviderTest::values for test method PHPUnit\TestFixture\Event\ArgumentDataProviderTest::testSuccess) +Data Provider Method Finished for PHPUnit\TestFixture\Event\ArgumentDataProviderTest::testSuccess: +- PHPUnit\TestFixture\Event\ArgumentDataProviderTest::values +Test Triggered PHPUnit Error (PHPUnit\TestFixture\Event\ArgumentDataProviderTest::testSuccess) +The data provider specified for PHPUnit\TestFixture\Event\ArgumentDataProviderTest::testSuccess is invalid +Data Provider method PHPUnit\TestFixture\Event\ArgumentDataProviderTest::values() expects an argument +Test Runner Triggered Warning (No tests found in class "PHPUnit\TestFixture\Event\ArgumentDataProviderTest".) +Test Suite Loaded (0 tests) +Event Facade Sealed +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (0 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 2) diff --git a/tests/end-to-end/event/data-provider-not-public.phpt b/tests/end-to-end/event/data-provider-not-public.phpt new file mode 100644 index 00000000000..5f725336660 --- /dev/null +++ b/tests/end-to-end/event/data-provider-not-public.phpt @@ -0,0 +1,43 @@ +--TEST-- +The right events are emitted in the right order for a test that uses a data provider that is not public +--SKIPIF-- +run($_SERVER['argv']); + +print file_get_contents($traceFile); + +unlink($traceFile); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Data Provider Method Called (PHPUnit\TestFixture\Event\PrivateDataProviderTest::values for test method PHPUnit\TestFixture\Event\PrivateDataProviderTest::testSuccess) +Data Provider Method Finished for PHPUnit\TestFixture\Event\PrivateDataProviderTest::testSuccess: +- PHPUnit\TestFixture\Event\PrivateDataProviderTest::values +Test Triggered PHPUnit Error (PHPUnit\TestFixture\Event\PrivateDataProviderTest::testSuccess) +The data provider specified for PHPUnit\TestFixture\Event\PrivateDataProviderTest::testSuccess is invalid +Data Provider method PHPUnit\TestFixture\Event\PrivateDataProviderTest::values() is not public +Test Runner Triggered Warning (No tests found in class "PHPUnit\TestFixture\Event\PrivateDataProviderTest".) +Test Suite Loaded (0 tests) +Event Facade Sealed +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (0 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 2) diff --git a/tests/end-to-end/event/data-provider-not-static.phpt b/tests/end-to-end/event/data-provider-not-static.phpt new file mode 100644 index 00000000000..96095e448df --- /dev/null +++ b/tests/end-to-end/event/data-provider-not-static.phpt @@ -0,0 +1,43 @@ +--TEST-- +The right events are emitted in the right order for a test that uses a data provider that is not static +--SKIPIF-- +run($_SERVER['argv']); + +print file_get_contents($traceFile); + +unlink($traceFile); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Data Provider Method Called (PHPUnit\TestFixture\Event\DynamicDataProviderTest::values for test method PHPUnit\TestFixture\Event\DynamicDataProviderTest::testSuccess) +Data Provider Method Finished for PHPUnit\TestFixture\Event\DynamicDataProviderTest::testSuccess: +- PHPUnit\TestFixture\Event\DynamicDataProviderTest::values +Test Triggered PHPUnit Error (PHPUnit\TestFixture\Event\DynamicDataProviderTest::testSuccess) +The data provider specified for PHPUnit\TestFixture\Event\DynamicDataProviderTest::testSuccess is invalid +Data Provider method PHPUnit\TestFixture\Event\DynamicDataProviderTest::values() is not static +Test Runner Triggered Warning (No tests found in class "PHPUnit\TestFixture\Event\DynamicDataProviderTest".) +Test Suite Loaded (0 tests) +Event Facade Sealed +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (0 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 2) diff --git a/tests/end-to-end/event/deprecations-can-be-ignored-using-attribute.phpt b/tests/end-to-end/event/deprecations-can-be-ignored-using-attribute.phpt new file mode 100644 index 00000000000..6f7643a073e --- /dev/null +++ b/tests/end-to-end/event/deprecations-can-be-ignored-using-attribute.phpt @@ -0,0 +1,52 @@ +--TEST-- +https://github.com/sebastianbergmann/phpunit/issues/5532 +--SKIPIF-- +run($_SERVER['argv']); + +print file_get_contents($traceFile); + +unlink($traceFile); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Test Suite Loaded (2 tests) +Event Facade Sealed +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (2 tests) +Test Suite Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 2 tests) +Test Preparation Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne) +Test Prepared (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne) +Test Triggered Test-Ignored Deprecation (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne) +message +Assertion Succeeded (Constraint: is true, Value: true) +Test Passed (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne) +Test Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo) +Test Prepared (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo) +Test Triggered Deprecation (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo) +message +Assertion Succeeded (Constraint: is true, Value: true) +Test Passed (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo) +Test Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo) +Test Suite Finished (PHPUnit\TestFixture\Event\IgnoreDeprecationsTest, 2 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/event/php-deprecated.phpt b/tests/end-to-end/event/php-deprecated.phpt index cc1b60b24c4..21e4aceb8d8 100644 --- a/tests/end-to-end/event/php-deprecated.phpt +++ b/tests/end-to-end/event/php-deprecated.phpt @@ -2,8 +2,8 @@ The right events are emitted in the right order for a test that runs code which triggers E_DEPRECATED --SKIPIF-- run($_SERVER['argv']); + +print file_get_contents($traceFile); + +unlink($traceFile); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Test Suite Loaded (1 test) +Event Facade Sealed +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (1 test) +Test Suite Started (PHPUnit\TestFixture\Metadata\Annotation\TestWithTest, 1 test) +Test Suite Started (PHPUnit\TestFixture\Metadata\Annotation\TestWithTest::testOne, 1 test) +Test Preparation Started (PHPUnit\TestFixture\Metadata\Annotation\TestWithTest::testOne#0) +Test Prepared (PHPUnit\TestFixture\Metadata\Annotation\TestWithTest::testOne#0) +Assertion Succeeded (Constraint: is true, Value: true) +Test Passed (PHPUnit\TestFixture\Metadata\Annotation\TestWithTest::testOne#0) +Test Finished (PHPUnit\TestFixture\Metadata\Annotation\TestWithTest::testOne#0) +Test Suite Finished (PHPUnit\TestFixture\Metadata\Annotation\TestWithTest::testOne, 1 test) +Test Suite Finished (PHPUnit\TestFixture\Metadata\Annotation\TestWithTest, 1 test) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/event/testwith-attribute.phpt b/tests/end-to-end/event/testwith-attribute.phpt new file mode 100644 index 00000000000..80957f96ed1 --- /dev/null +++ b/tests/end-to-end/event/testwith-attribute.phpt @@ -0,0 +1,52 @@ +--TEST-- +The right events are emitted in the right order for a successful test that uses the TestWith and TestWithJson attributes +--SKIPIF-- +run($_SERVER['argv']); + +print file_get_contents($traceFile); + +unlink($traceFile); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Test Suite Loaded (2 tests) +Event Facade Sealed +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (2 tests) +Test Suite Started (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest, 2 tests) +Test Suite Started (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testOne, 1 test) +Test Preparation Started (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testOne#0) +Test Prepared (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testOne#0) +Assertion Succeeded (Constraint: is true, Value: true) +Test Passed (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testOne#0) +Test Finished (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testOne#0) +Test Suite Finished (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testOne, 1 test) +Test Suite Started (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testTwo, 1 test) +Test Preparation Started (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testTwo#0) +Test Prepared (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testTwo#0) +Assertion Succeeded (Constraint: is true, Value: true) +Test Passed (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testTwo#0) +Test Finished (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testTwo#0) +Test Suite Finished (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest::testTwo, 1 test) +Test Suite Finished (PHPUnit\TestFixture\Metadata\Attribute\TestWithTest, 2 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/generic/deprecations-can-be-ignored-using-attribute.phpt b/tests/end-to-end/generic/deprecations-can-be-ignored-using-attribute.phpt new file mode 100644 index 00000000000..a08eb198123 --- /dev/null +++ b/tests/end-to-end/generic/deprecations-can-be-ignored-using-attribute.phpt @@ -0,0 +1,33 @@ +--TEST-- +https://github.com/sebastianbergmann/phpunit/issues/5532 +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: %s + +.D 2 / 2 (100%) + +Time: %s, Memory: %s + +1 test triggered 1 deprecation: + +1) %sIgnoreDeprecationsTest.php:%d +message + +Triggered by: + +* PHPUnit\TestFixture\Event\IgnoreDeprecationsTest::testTwo + %sIgnoreDeprecationsTest.php:%d + +OK, but there were issues! +Tests: 2, Assertions: 2, Deprecations: 1. diff --git a/tests/end-to-end/logging/_files/raw_output_StatusTest.txt b/tests/end-to-end/logging/_files/raw_output_StatusTest.txt index 3e2e28cd01c..407586f92ad 100644 --- a/tests/end-to-end/logging/_files/raw_output_StatusTest.txt +++ b/tests/end-to-end/logging/_files/raw_output_StatusTest.txt @@ -5,7 +5,7 @@ Configuration: %sconfiguration.basic.xml Time: %s, Memory: %s -Set Up Before Class (PHPUnit\SelfTest\Basic\SetUpBeforeClass) +Set Up Before Class (PHPUnit\TestFixture\Basic\SetUpBeforeClass) ✘ One  %f ms ┐ ├ Exception: forcing an Exception in setUpBeforeClass() @@ -18,7 +18,7 @@ Time: %s, Memory: %s ├ This test was skipped due to an error in a hook method ┴ -Set Up (PHPUnit\SelfTest\Basic\SetUp) +Set Up (PHPUnit\TestFixture\Basic\SetUp) ✘ One with set up exception  %f ms ┐ ├ RuntimeException: throw exception in setUp @@ -111,12 +111,12 @@ Time: %s, Memory: %s ╵ %stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php:%d ┴ -Tear Down After Class (PHPUnit\SelfTest\Basic\TearDownAfterClass) +Tear Down After Class (PHPUnit\TestFixture\Basic\TearDownAfterClass) ✔ One  %f ms ✔ Two  %f ms ✘ Tear down after class  0 ms ┐ - ├ Exception in PHPUnit\SelfTest\Basic\TearDownAfterClassTest::tearDownAfterClass + ├ Exception in PHPUnit\TestFixture\Basic\TearDownAfterClassTest::tearDownAfterClass ├ forcing an Exception in tearDownAfterClass()  │ ╵ %stests%eend-to-end%e_files%ebasic%eunit%eTearDownAfterClassTest.php:%d diff --git a/tests/end-to-end/logging/log-junit-to-file.phpt b/tests/end-to-end/logging/log-junit-to-file.phpt index 254cd499413..872378a2471 100644 --- a/tests/end-to-end/logging/log-junit-to-file.phpt +++ b/tests/end-to-end/logging/log-junit-to-file.phpt @@ -26,50 +26,50 @@ unlink($logfile); --EXPECTF-- - - - - PHPUnit\SelfTest\Basic\StatusTest::testFailure%A + + + + PHPUnit\TestFixture\Basic\StatusTest::testFailure%A Failed asserting that false is true. %A %sStatusTest.php:%d - - PHPUnit\SelfTest\Basic\StatusTest::testError%A + + PHPUnit\TestFixture\Basic\StatusTest::testError%A RuntimeException:%w %A %sStatusTest.php:%d - + - + - - - - PHPUnit\SelfTest\Basic\StatusTest::testFailureWithMessage%A + + + + PHPUnit\TestFixture\Basic\StatusTest::testFailureWithMessage%A failure with custom message Failed asserting that false is true. %A %sStatusTest.php:%d - - PHPUnit\SelfTest\Basic\StatusTest::testErrorWithMessage%A + + PHPUnit\TestFixture\Basic\StatusTest::testErrorWithMessage%A RuntimeException: error with custom message %A %sStatusTest.php:%d - + - + - + - + diff --git a/tests/end-to-end/logging/log-junit-to-stdout.phpt b/tests/end-to-end/logging/log-junit-to-stdout.phpt index c59fb2d12de..f481658b6e7 100644 --- a/tests/end-to-end/logging/log-junit-to-stdout.phpt +++ b/tests/end-to-end/logging/log-junit-to-stdout.phpt @@ -15,50 +15,50 @@ require_once __DIR__ . '/../../bootstrap.php'; --EXPECTF-- - - - - PHPUnit\SelfTest\Basic\StatusTest::testFailure%A + + + + PHPUnit\TestFixture\Basic\StatusTest::testFailure%A Failed asserting that false is true. %A %sStatusTest.php:%d - - PHPUnit\SelfTest\Basic\StatusTest::testError%A + + PHPUnit\TestFixture\Basic\StatusTest::testError%A RuntimeException:%w %A %sStatusTest.php:%d - + - + - - - - PHPUnit\SelfTest\Basic\StatusTest::testFailureWithMessage%A + + + + PHPUnit\TestFixture\Basic\StatusTest::testFailureWithMessage%A failure with custom message Failed asserting that false is true. %A %sStatusTest.php:%d - - PHPUnit\SelfTest\Basic\StatusTest::testErrorWithMessage%A + + PHPUnit\TestFixture\Basic\StatusTest::testErrorWithMessage%A RuntimeException: error with custom message %A %sStatusTest.php:%d - + - + - + - + diff --git a/tests/end-to-end/logging/log-teamcity.phpt b/tests/end-to-end/logging/log-teamcity.phpt index 297230aeb7a..57a4841c7ff 100644 --- a/tests/end-to-end/logging/log-teamcity.phpt +++ b/tests/end-to-end/logging/log-teamcity.phpt @@ -15,59 +15,59 @@ require_once __DIR__ . '/../../bootstrap.php'; --EXPECTF-- ##teamcity[testCount count='13' flowId='%d'] -##teamcity[testSuiteStarted name='PHPUnit\SelfTest\Basic\StatusTest' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest' flowId='%d'] +##teamcity[testSuiteStarted name='PHPUnit\TestFixture\Basic\StatusTest' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest' flowId='%d'] -##teamcity[testStarted name='testSuccess' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSuccess' flowId='%d'] +##teamcity[testStarted name='testSuccess' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSuccess' flowId='%d'] ##teamcity[testFinished name='testSuccess' duration='%d' flowId='%d'] -##teamcity[testStarted name='testFailure' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testFailure' flowId='%d'] +##teamcity[testStarted name='testFailure' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testFailure' flowId='%d'] ##teamcity[testFailed name='testFailure' message='Failed asserting that false is true.' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testFailure' duration='%d' flowId='%d'] -##teamcity[testStarted name='testError' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testError' flowId='%d'] +##teamcity[testStarted name='testError' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testError' flowId='%d'] ##teamcity[testFailed name='testError' message='RuntimeException' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testError' duration='%d' flowId='%d'] -##teamcity[testStarted name='testIncomplete' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testIncomplete' flowId='%d'] +##teamcity[testStarted name='testIncomplete' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testIncomplete' flowId='%d'] ##teamcity[testIgnored name='testIncomplete' message='' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testIncomplete' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSkipped' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSkipped' flowId='%d'] +##teamcity[testStarted name='testSkipped' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSkipped' flowId='%d'] ##teamcity[testIgnored name='testSkipped' message='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testSkipped' duration='%d' flowId='%d'] -##teamcity[testStarted name='testRisky' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testRisky' flowId='%d'] +##teamcity[testStarted name='testRisky' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testRisky' flowId='%d'] ##teamcity[testFailed name='testRisky' message='This test did not perform any assertions' details='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testRisky' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSuccessWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSuccessWithMessage' flowId='%d'] +##teamcity[testStarted name='testSuccessWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSuccessWithMessage' flowId='%d'] ##teamcity[testFinished name='testSuccessWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testFailureWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testFailureWithMessage' flowId='%d'] +##teamcity[testStarted name='testFailureWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testFailureWithMessage' flowId='%d'] ##teamcity[testFailed name='testFailureWithMessage' message='failure with custom message|nFailed asserting that false is true.' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testFailureWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testErrorWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testErrorWithMessage' flowId='%d'] +##teamcity[testStarted name='testErrorWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testErrorWithMessage' flowId='%d'] ##teamcity[testFailed name='testErrorWithMessage' message='RuntimeException: error with custom message' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testErrorWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testIncompleteWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testIncompleteWithMessage' flowId='%d'] +##teamcity[testStarted name='testIncompleteWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testIncompleteWithMessage' flowId='%d'] ##teamcity[testIgnored name='testIncompleteWithMessage' message='incomplete with custom message' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] @@ -75,16 +75,16 @@ require_once __DIR__ . '/../../bootstrap.php'; ##teamcity[testIgnored name='testSkippedByMetadata' message='PHP > 9000 is required.' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSkippedWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSkippedWithMessage' flowId='%d'] +##teamcity[testStarted name='testSkippedWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSkippedWithMessage' flowId='%d'] ##teamcity[testIgnored name='testSkippedWithMessage' message='skipped with custom message' duration='%d' flowId='%d'] ##teamcity[testFinished name='testSkippedWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testRiskyWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testRiskyWithMessage' flowId='%d'] +##teamcity[testStarted name='testRiskyWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testRiskyWithMessage' flowId='%d'] ##teamcity[testFailed name='testRiskyWithMessage' message='This test did not perform any assertions' details='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testRiskyWithMessage' duration='%d' flowId='%d'] -##teamcity[testSuiteFinished name='PHPUnit\SelfTest\Basic\StatusTest' flowId='%d'] +##teamcity[testSuiteFinished name='PHPUnit\TestFixture\Basic\StatusTest' flowId='%d'] diff --git a/tests/end-to-end/logging/teamcity-directory.phpt b/tests/end-to-end/logging/teamcity-directory.phpt index 651b32f72ba..2b53a40af4d 100644 --- a/tests/end-to-end/logging/teamcity-directory.phpt +++ b/tests/end-to-end/logging/teamcity-directory.phpt @@ -20,69 +20,69 @@ Runtime: %s ##teamcity[testSuiteStarted name='CLI Arguments' flowId='%d'] -##teamcity[testSuiteStarted name='PHPUnit\SelfTest\Basic\SetUpBeforeClassTest' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eSetUpBeforeClassTest.php::\PHPUnit\SelfTest\Basic\SetUpBeforeClassTest' flowId='%d'] +##teamcity[testSuiteStarted name='PHPUnit\TestFixture\Basic\SetUpBeforeClassTest' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eSetUpBeforeClassTest.php::\PHPUnit\TestFixture\Basic\SetUpBeforeClassTest' flowId='%d'] -##teamcity[testSuiteStarted name='PHPUnit\SelfTest\Basic\SetUpTest' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eSetUpTest.php::\PHPUnit\SelfTest\Basic\SetUpTest' flowId='%d'] +##teamcity[testSuiteStarted name='PHPUnit\TestFixture\Basic\SetUpTest' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eSetUpTest.php::\PHPUnit\TestFixture\Basic\SetUpTest' flowId='%d'] ##teamcity[testFailed name='testOneWithSetUpException' message='RuntimeException: throw exception in setUp' details='%stests%eend-to-end%e_files%ebasic%eunit%eSetUpTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFailed name='testTwoWithSetUpException' message='RuntimeException: throw exception in setUp' details='%stests%eend-to-end%e_files%ebasic%eunit%eSetUpTest.php:%d|n' duration='%d' flowId='%d'] -##teamcity[testSuiteFinished name='PHPUnit\SelfTest\Basic\SetUpTest' flowId='%d'] +##teamcity[testSuiteFinished name='PHPUnit\TestFixture\Basic\SetUpTest' flowId='%d'] -##teamcity[testSuiteStarted name='PHPUnit\SelfTest\Basic\StatusTest' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest' flowId='%d'] +##teamcity[testSuiteStarted name='PHPUnit\TestFixture\Basic\StatusTest' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest' flowId='%d'] -##teamcity[testStarted name='testSuccess' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSuccess' flowId='%d'] +##teamcity[testStarted name='testSuccess' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSuccess' flowId='%d'] ##teamcity[testFinished name='testSuccess' duration='%d' flowId='%d'] -##teamcity[testStarted name='testFailure' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testFailure' flowId='%d'] +##teamcity[testStarted name='testFailure' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testFailure' flowId='%d'] ##teamcity[testFailed name='testFailure' message='Failed asserting that false is true.' details='%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testFailure' duration='%d' flowId='%d'] -##teamcity[testStarted name='testError' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testError' flowId='%d'] +##teamcity[testStarted name='testError' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testError' flowId='%d'] ##teamcity[testFailed name='testError' message='RuntimeException' details='%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testError' duration='%d' flowId='%d'] -##teamcity[testStarted name='testIncomplete' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testIncomplete' flowId='%d'] +##teamcity[testStarted name='testIncomplete' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testIncomplete' flowId='%d'] ##teamcity[testIgnored name='testIncomplete' message='' details='%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testIncomplete' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSkipped' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSkipped' flowId='%d'] +##teamcity[testStarted name='testSkipped' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSkipped' flowId='%d'] ##teamcity[testIgnored name='testSkipped' message='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testSkipped' duration='%d' flowId='%d'] -##teamcity[testStarted name='testRisky' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testRisky' flowId='%d'] +##teamcity[testStarted name='testRisky' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testRisky' flowId='%d'] ##teamcity[testFailed name='testRisky' message='This test did not perform any assertions' details='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testRisky' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSuccessWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSuccessWithMessage' flowId='%d'] +##teamcity[testStarted name='testSuccessWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSuccessWithMessage' flowId='%d'] ##teamcity[testFinished name='testSuccessWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testFailureWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testFailureWithMessage' flowId='%d'] +##teamcity[testStarted name='testFailureWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testFailureWithMessage' flowId='%d'] ##teamcity[testFailed name='testFailureWithMessage' message='failure with custom message|nFailed asserting that false is true.' details='%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testFailureWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testErrorWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testErrorWithMessage' flowId='%d'] +##teamcity[testStarted name='testErrorWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testErrorWithMessage' flowId='%d'] ##teamcity[testFailed name='testErrorWithMessage' message='RuntimeException: error with custom message' details='%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testErrorWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testIncompleteWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testIncompleteWithMessage' flowId='%d'] +##teamcity[testStarted name='testIncompleteWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testIncompleteWithMessage' flowId='%d'] ##teamcity[testIgnored name='testIncompleteWithMessage' message='incomplete with custom message' details='%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php:%d|n' duration='%d' flowId='%d'] @@ -90,58 +90,58 @@ Runtime: %s ##teamcity[testIgnored name='testSkippedByMetadata' message='PHP > 9000 is required.' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSkippedWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSkippedWithMessage' flowId='%d'] +##teamcity[testStarted name='testSkippedWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSkippedWithMessage' flowId='%d'] ##teamcity[testIgnored name='testSkippedWithMessage' message='skipped with custom message' duration='%d' flowId='%d'] ##teamcity[testFinished name='testSkippedWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testRiskyWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testRiskyWithMessage' flowId='%d'] +##teamcity[testStarted name='testRiskyWithMessage' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testRiskyWithMessage' flowId='%d'] ##teamcity[testFailed name='testRiskyWithMessage' message='This test did not perform any assertions' details='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testRiskyWithMessage' duration='%d' flowId='%d'] -##teamcity[testSuiteFinished name='PHPUnit\SelfTest\Basic\StatusTest' flowId='%d'] +##teamcity[testSuiteFinished name='PHPUnit\TestFixture\Basic\StatusTest' flowId='%d'] -##teamcity[testSuiteStarted name='PHPUnit\SelfTest\Basic\TearDownAfterClassTest' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eTearDownAfterClassTest.php::\PHPUnit\SelfTest\Basic\TearDownAfterClassTest' flowId='%d'] +##teamcity[testSuiteStarted name='PHPUnit\TestFixture\Basic\TearDownAfterClassTest' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eTearDownAfterClassTest.php::\PHPUnit\TestFixture\Basic\TearDownAfterClassTest' flowId='%d'] -##teamcity[testStarted name='testOne' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eTearDownAfterClassTest.php::\PHPUnit\SelfTest\Basic\TearDownAfterClassTest::testOne' flowId='%d'] +##teamcity[testStarted name='testOne' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eTearDownAfterClassTest.php::\PHPUnit\TestFixture\Basic\TearDownAfterClassTest::testOne' flowId='%d'] ##teamcity[testFinished name='testOne' duration='%d' flowId='%d'] -##teamcity[testStarted name='testTwo' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eTearDownAfterClassTest.php::\PHPUnit\SelfTest\Basic\TearDownAfterClassTest::testTwo' flowId='%d'] +##teamcity[testStarted name='testTwo' locationHint='php_qn://%stests%eend-to-end%e_files%ebasic%eunit%eTearDownAfterClassTest.php::\PHPUnit\TestFixture\Basic\TearDownAfterClassTest::testTwo' flowId='%d'] ##teamcity[testFinished name='testTwo' duration='%d' flowId='%d'] -##teamcity[testSuiteFinished name='PHPUnit\SelfTest\Basic\TearDownAfterClassTest' flowId='%d'] +##teamcity[testSuiteFinished name='PHPUnit\TestFixture\Basic\TearDownAfterClassTest' flowId='%d'] ##teamcity[testSuiteFinished name='CLI Arguments' flowId='%d'] Time: %s, Memory: %s There were 5 errors: -1) PHPUnit\SelfTest\Basic\SetUpBeforeClassTest +1) PHPUnit\TestFixture\Basic\SetUpBeforeClassTest Exception: forcing an Exception in setUpBeforeClass() %s%eSetUpBeforeClassTest.php:%d -2) PHPUnit\SelfTest\Basic\SetUpTest::testOneWithSetUpException +2) PHPUnit\TestFixture\Basic\SetUpTest::testOneWithSetUpException RuntimeException: throw exception in setUp %s%eSetUpTest.php:%d -3) PHPUnit\SelfTest\Basic\SetUpTest::testTwoWithSetUpException +3) PHPUnit\TestFixture\Basic\SetUpTest::testTwoWithSetUpException RuntimeException: throw exception in setUp %s%eSetUpTest.php:%d -4) PHPUnit\SelfTest\Basic\StatusTest::testError +4) PHPUnit\TestFixture\Basic\StatusTest::testError RuntimeException: %s%eStatusTest.php:%d -5) PHPUnit\SelfTest\Basic\StatusTest::testErrorWithMessage +5) PHPUnit\TestFixture\Basic\StatusTest::testErrorWithMessage RuntimeException: error with custom message %s%eStatusTest.php:%d @@ -150,12 +150,12 @@ RuntimeException: error with custom message There were 2 failures: -1) PHPUnit\SelfTest\Basic\StatusTest::testFailure +1) PHPUnit\TestFixture\Basic\StatusTest::testFailure Failed asserting that false is true. %s%eStatusTest.php:%d -2) PHPUnit\SelfTest\Basic\StatusTest::testFailureWithMessage +2) PHPUnit\TestFixture\Basic\StatusTest::testFailureWithMessage failure with custom message Failed asserting that false is true. @@ -165,12 +165,12 @@ Failed asserting that false is true. There were 2 risky tests: -1) PHPUnit\SelfTest\Basic\StatusTest::testRisky +1) PHPUnit\TestFixture\Basic\StatusTest::testRisky This test did not perform any assertions %s%eStatusTest.php:%d -2) PHPUnit\SelfTest\Basic\StatusTest::testRiskyWithMessage +2) PHPUnit\TestFixture\Basic\StatusTest::testRiskyWithMessage This test did not perform any assertions %s%eStatusTest.php:%d diff --git a/tests/end-to-end/logging/teamcity-file.phpt b/tests/end-to-end/logging/teamcity-file.phpt index a136244ddf2..8e850f95ab7 100644 --- a/tests/end-to-end/logging/teamcity-file.phpt +++ b/tests/end-to-end/logging/teamcity-file.phpt @@ -18,59 +18,59 @@ Runtime: %s ##teamcity[testCount count='13' flowId='%d'] -##teamcity[testSuiteStarted name='PHPUnit\SelfTest\Basic\StatusTest' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest' flowId='%d'] +##teamcity[testSuiteStarted name='PHPUnit\TestFixture\Basic\StatusTest' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest' flowId='%d'] -##teamcity[testStarted name='testSuccess' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSuccess' flowId='%d'] +##teamcity[testStarted name='testSuccess' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSuccess' flowId='%d'] ##teamcity[testFinished name='testSuccess' duration='%d' flowId='%d'] -##teamcity[testStarted name='testFailure' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testFailure' flowId='%d'] +##teamcity[testStarted name='testFailure' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testFailure' flowId='%d'] ##teamcity[testFailed name='testFailure' message='Failed asserting that false is true.' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testFailure' duration='%d' flowId='%d'] -##teamcity[testStarted name='testError' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testError' flowId='%d'] +##teamcity[testStarted name='testError' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testError' flowId='%d'] ##teamcity[testFailed name='testError' message='RuntimeException' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testError' duration='%d' flowId='%d'] -##teamcity[testStarted name='testIncomplete' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testIncomplete' flowId='%d'] +##teamcity[testStarted name='testIncomplete' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testIncomplete' flowId='%d'] ##teamcity[testIgnored name='testIncomplete' message='' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testIncomplete' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSkipped' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSkipped' flowId='%d'] +##teamcity[testStarted name='testSkipped' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSkipped' flowId='%d'] ##teamcity[testIgnored name='testSkipped' message='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testSkipped' duration='%d' flowId='%d'] -##teamcity[testStarted name='testRisky' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testRisky' flowId='%d'] +##teamcity[testStarted name='testRisky' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testRisky' flowId='%d'] ##teamcity[testFailed name='testRisky' message='This test did not perform any assertions' details='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testRisky' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSuccessWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSuccessWithMessage' flowId='%d'] +##teamcity[testStarted name='testSuccessWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSuccessWithMessage' flowId='%d'] ##teamcity[testFinished name='testSuccessWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testFailureWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testFailureWithMessage' flowId='%d'] +##teamcity[testStarted name='testFailureWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testFailureWithMessage' flowId='%d'] ##teamcity[testFailed name='testFailureWithMessage' message='failure with custom message|nFailed asserting that false is true.' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testFailureWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testErrorWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testErrorWithMessage' flowId='%d'] +##teamcity[testStarted name='testErrorWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testErrorWithMessage' flowId='%d'] ##teamcity[testFailed name='testErrorWithMessage' message='RuntimeException: error with custom message' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] ##teamcity[testFinished name='testErrorWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testIncompleteWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testIncompleteWithMessage' flowId='%d'] +##teamcity[testStarted name='testIncompleteWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testIncompleteWithMessage' flowId='%d'] ##teamcity[testIgnored name='testIncompleteWithMessage' message='incomplete with custom message' details='%sStatusTest.php:%d|n' duration='%d' flowId='%d'] @@ -78,29 +78,29 @@ Runtime: %s ##teamcity[testIgnored name='testSkippedByMetadata' message='PHP > 9000 is required.' duration='%d' flowId='%d'] -##teamcity[testStarted name='testSkippedWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testSkippedWithMessage' flowId='%d'] +##teamcity[testStarted name='testSkippedWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testSkippedWithMessage' flowId='%d'] ##teamcity[testIgnored name='testSkippedWithMessage' message='skipped with custom message' duration='%d' flowId='%d'] ##teamcity[testFinished name='testSkippedWithMessage' duration='%d' flowId='%d'] -##teamcity[testStarted name='testRiskyWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\SelfTest\Basic\StatusTest::testRiskyWithMessage' flowId='%d'] +##teamcity[testStarted name='testRiskyWithMessage' locationHint='php_qn://%sStatusTest.php::\PHPUnit\TestFixture\Basic\StatusTest::testRiskyWithMessage' flowId='%d'] ##teamcity[testFailed name='testRiskyWithMessage' message='This test did not perform any assertions' details='' duration='%d' flowId='%d'] ##teamcity[testFinished name='testRiskyWithMessage' duration='%d' flowId='%d'] -##teamcity[testSuiteFinished name='PHPUnit\SelfTest\Basic\StatusTest' flowId='%d'] +##teamcity[testSuiteFinished name='PHPUnit\TestFixture\Basic\StatusTest' flowId='%d'] Time: %s, Memory: %s There were 2 errors: -1) PHPUnit\SelfTest\Basic\StatusTest::testError +1) PHPUnit\TestFixture\Basic\StatusTest::testError RuntimeException: %s%eStatusTest.php:%d -2) PHPUnit\SelfTest\Basic\StatusTest::testErrorWithMessage +2) PHPUnit\TestFixture\Basic\StatusTest::testErrorWithMessage RuntimeException: error with custom message %s%eStatusTest.php:%d @@ -109,12 +109,12 @@ RuntimeException: error with custom message There were 2 failures: -1) PHPUnit\SelfTest\Basic\StatusTest::testFailure +1) PHPUnit\TestFixture\Basic\StatusTest::testFailure Failed asserting that false is true. %s%eStatusTest.php:%d -2) PHPUnit\SelfTest\Basic\StatusTest::testFailureWithMessage +2) PHPUnit\TestFixture\Basic\StatusTest::testFailureWithMessage failure with custom message Failed asserting that false is true. @@ -124,12 +124,12 @@ Failed asserting that false is true. There were 2 risky tests: -1) PHPUnit\SelfTest\Basic\StatusTest::testRisky +1) PHPUnit\TestFixture\Basic\StatusTest::testRisky This test did not perform any assertions %s%eStatusTest.php:%d -2) PHPUnit\SelfTest\Basic\StatusTest::testRiskyWithMessage +2) PHPUnit\TestFixture\Basic\StatusTest::testRiskyWithMessage This test did not perform any assertions %s%eStatusTest.php:%d diff --git a/tests/end-to-end/mock-objects/generator/232.phpt b/tests/end-to-end/mock-objects/generator/232.phpt index 5b20c1812eb..d471dc1c8d7 100644 --- a/tests/end-to-end/mock-objects/generator/232.phpt +++ b/tests/end-to-end/mock-objects/generator/232.phpt @@ -45,6 +45,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -59,6 +60,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt b/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt index 4c128181f9b..ff103fdd4b4 100644 --- a/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt +++ b/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt @@ -30,6 +30,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( Issue3154::class, true, + true, [], 'Issue3154Mock', true, @@ -44,6 +45,7 @@ class Issue3154Mock extends Is\Namespaced\Issue3154 implements PHPUnit\Framework { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/3967.phpt b/tests/end-to-end/mock-objects/generator/3967.phpt index 6985c72bb04..47b2998b9aa 100644 --- a/tests/end-to-end/mock-objects/generator/3967.phpt +++ b/tests/end-to-end/mock-objects/generator/3967.phpt @@ -18,6 +18,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Baz', true, + true, [], 'MockBaz', true, @@ -32,6 +33,7 @@ class MockBaz extends Exception implements Baz, PHPUnit\Framework\MockObject\Moc { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\ProxiedCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/397.phpt b/tests/end-to-end/mock-objects/generator/397.phpt index 30612907459..07144fef04c 100644 --- a/tests/end-to-end/mock-objects/generator/397.phpt +++ b/tests/end-to-end/mock-objects/generator/397.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( C::class, true, + true, [], 'MockC', true, @@ -30,6 +31,7 @@ class MockC extends C implements PHPUnit\Framework\MockObject\MockObjectInternal { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/4139.phpt b/tests/end-to-end/mock-objects/generator/4139.phpt index 5ec17288ef9..067c0e2f921 100644 --- a/tests/end-to-end/mock-objects/generator/4139.phpt +++ b/tests/end-to-end/mock-objects/generator/4139.phpt @@ -10,7 +10,7 @@ require_once __DIR__ . '/../../../bootstrap.php'; $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; -$mock = $generator->generate(InterfaceWithConstructor::class, true); +$mock = $generator->generate(InterfaceWithConstructor::class, true, true); print $mock->classCode(); --EXPECTF-- @@ -20,6 +20,7 @@ class %s implements PHPUnit\Framework\MockObject\MockObjectInternal, InterfaceWi { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/abstract_class.phpt b/tests/end-to-end/mock-objects/generator/abstract_class.phpt index 0c1d92afa8d..d816760f8d3 100644 --- a/tests/end-to-end/mock-objects/generator/abstract_class.phpt +++ b/tests/end-to-end/mock-objects/generator/abstract_class.phpt @@ -20,6 +20,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -34,6 +35,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/class.phpt b/tests/end-to-end/mock-objects/generator/class.phpt index d5a4b202728..900ce27886e 100644 --- a/tests/end-to-end/mock-objects/generator/class.phpt +++ b/tests/end-to-end/mock-objects/generator/class.phpt @@ -20,6 +20,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -34,6 +35,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/class_call_parent_clone.phpt b/tests/end-to-end/mock-objects/generator/class_call_parent_clone.phpt index 265d7544b22..21c6e32bf48 100644 --- a/tests/end-to-end/mock-objects/generator/class_call_parent_clone.phpt +++ b/tests/end-to-end/mock-objects/generator/class_call_parent_clone.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true @@ -29,6 +30,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\ProxiedCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/class_call_parent_constructor.phpt b/tests/end-to-end/mock-objects/generator/class_call_parent_constructor.phpt index 560f99de34d..1b9a017a478 100644 --- a/tests/end-to-end/mock-objects/generator/class_call_parent_constructor.phpt +++ b/tests/end-to-end/mock-objects/generator/class_call_parent_constructor.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true @@ -29,6 +30,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/class_dont_call_parent_clone.phpt b/tests/end-to-end/mock-objects/generator/class_dont_call_parent_clone.phpt index be28c3ca065..f42a165b7db 100644 --- a/tests/end-to-end/mock-objects/generator/class_dont_call_parent_clone.phpt +++ b/tests/end-to-end/mock-objects/generator/class_dont_call_parent_clone.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', false @@ -29,6 +30,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/class_dont_call_parent_constructor.phpt b/tests/end-to-end/mock-objects/generator/class_dont_call_parent_constructor.phpt index 560f99de34d..1b9a017a478 100644 --- a/tests/end-to-end/mock-objects/generator/class_dont_call_parent_constructor.phpt +++ b/tests/end-to-end/mock-objects/generator/class_dont_call_parent_constructor.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true @@ -29,6 +30,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/class_implementing_interface_call_parent_constructor.phpt b/tests/end-to-end/mock-objects/generator/class_implementing_interface_call_parent_constructor.phpt index 19a3c3290d3..8ec3ad96886 100644 --- a/tests/end-to-end/mock-objects/generator/class_implementing_interface_call_parent_constructor.phpt +++ b/tests/end-to-end/mock-objects/generator/class_implementing_interface_call_parent_constructor.phpt @@ -21,6 +21,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true @@ -34,6 +35,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/class_implementing_interface_dont_call_parent_constructor.phpt b/tests/end-to-end/mock-objects/generator/class_implementing_interface_dont_call_parent_constructor.phpt index 19a3c3290d3..8ec3ad96886 100644 --- a/tests/end-to-end/mock-objects/generator/class_implementing_interface_dont_call_parent_constructor.phpt +++ b/tests/end-to-end/mock-objects/generator/class_implementing_interface_dont_call_parent_constructor.phpt @@ -21,6 +21,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true @@ -34,6 +35,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt b/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt index 6cabb3511a9..4f80ec31699 100644 --- a/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt +++ b/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, ['bar'], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/class_partial.phpt b/tests/end-to-end/mock-objects/generator/class_partial.phpt index 28eb63acb98..8a029962076 100644 --- a/tests/end-to-end/mock-objects/generator/class_partial.phpt +++ b/tests/end-to-end/mock-objects/generator/class_partial.phpt @@ -20,6 +20,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, ['bar'], 'MockFoo', true, @@ -34,6 +35,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt b/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt index d8de82d8048..bd21e5292cd 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt @@ -20,6 +20,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'ClassWithDeprecatedMethod', true, + true, [], 'MockFoo', TRUE, @@ -34,6 +35,7 @@ class MockFoo extends ClassWithDeprecatedMethod implements PHPUnit\Framework\Moc { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/class_with_final_method.phpt b/tests/end-to-end/mock-objects/generator/class_with_final_method.phpt index 761fc00662a..ed0763c0258 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_final_method.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_final_method.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'ClassWithFinalMethod', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends ClassWithFinalMethod implements PHPUnit\Framework\MockObje { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt b/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt index f24b703cfee..00214983b84 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\DoubledCloneMethod; public function method() diff --git a/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt b/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt index 7df35463332..b36dce16adb 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'ClassWithMethodWithNullableTypehintedVariadicArguments', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends ClassWithMethodWithNullableTypehintedVariadicArguments imp { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt b/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt index 03fc0d50ed7..f8751f1bc69 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'ClassWithMethodWithTypehintedVariadicArguments', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends ClassWithMethodWithTypehintedVariadicArguments implements { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt b/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt index e9d54ea5383..df7c6954ef0 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'ClassWithMethodWithVariadicArguments', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends ClassWithMethodWithVariadicArguments implements PHPUnit\Fr { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt b/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt index 1b4f00f8d2f..3b81d1ebed0 100644 --- a/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt +++ b/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/interface.phpt b/tests/end-to-end/mock-objects/generator/interface.phpt index 05210cf5d3d..78584fa6c15 100644 --- a/tests/end-to-end/mock-objects/generator/interface.phpt +++ b/tests/end-to-end/mock-objects/generator/interface.phpt @@ -14,6 +14,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -28,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt b/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt index 831856d8e37..dc6f78c2c06 100644 --- a/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt +++ b/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt @@ -20,6 +20,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -35,6 +36,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class.phpt index fa804a67dc4..842a5c776af 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class.phpt @@ -22,6 +22,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', true, @@ -36,6 +37,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_clone.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_clone.phpt index 16fc592f66a..59286197333 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_clone.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_clone.phpt @@ -18,6 +18,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', true @@ -31,6 +32,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\ProxiedCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_constructor.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_constructor.phpt index cfcc72219bd..11ade685327 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_constructor.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_constructor.phpt @@ -18,6 +18,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', true @@ -31,6 +32,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_clone.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_clone.phpt index 1c518c83ffa..f503112da54 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_clone.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_clone.phpt @@ -18,6 +18,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', false @@ -31,6 +32,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_constructor.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_constructor.phpt index cfcc72219bd..11ade685327 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_constructor.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_constructor.phpt @@ -18,6 +18,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', true @@ -31,6 +32,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_call_parent_constructor.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_call_parent_constructor.phpt index 7112355589d..840f7733d34 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_call_parent_constructor.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_call_parent_constructor.phpt @@ -23,6 +23,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', true @@ -36,6 +37,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt index 7112355589d..840f7733d34 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt @@ -23,6 +23,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', true @@ -36,6 +37,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt index a7320588aad..aa4e3fce052 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt @@ -22,6 +22,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, ['bar'], 'MockFoo', true, @@ -36,6 +37,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt b/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt index d9a907c368f..50f21a80e13 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, NS\Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/nonexistent_class.phpt b/tests/end-to-end/mock-objects/generator/nonexistent_class.phpt index 4dc782bc682..a674e6697b8 100644 --- a/tests/end-to-end/mock-objects/generator/nonexistent_class.phpt +++ b/tests/end-to-end/mock-objects/generator/nonexistent_class.phpt @@ -9,6 +9,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NonExistentClass', true, + true, [], 'MockFoo', true, @@ -27,6 +28,7 @@ class MockFoo extends NonExistentClass implements PHPUnit\Framework\MockObject\M { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace.phpt b/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace.phpt index f18c51ea402..4c981d9b713 100644 --- a/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace.phpt +++ b/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace.phpt @@ -9,6 +9,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'NS\Foo', true, + true, [], 'MockFoo', true, @@ -33,6 +34,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace_starting_with_separator.phpt b/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace_starting_with_separator.phpt index 6770d55960f..0a31e9fc572 100644 --- a/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace_starting_with_separator.phpt +++ b/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace_starting_with_separator.phpt @@ -9,6 +9,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( '\NS\Foo', true, + true, [], 'MockFoo', true, @@ -33,6 +34,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; } diff --git a/tests/end-to-end/mock-objects/generator/nullable_types.phpt b/tests/end-to-end/mock-objects/generator/nullable_types.phpt index a635288b493..64f50357037 100644 --- a/tests/end-to-end/mock-objects/generator/nullable_types.phpt +++ b/tests/end-to-end/mock-objects/generator/nullable_types.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/nullable_union_type_parameter.phpt b/tests/end-to-end/mock-objects/generator/nullable_union_type_parameter.phpt index 2443c181f01..24aeb38bf46 100644 --- a/tests/end-to-end/mock-objects/generator/nullable_union_type_parameter.phpt +++ b/tests/end-to-end/mock-objects/generator/nullable_union_type_parameter.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( Foo::class, true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/nullable_union_type_return.phpt b/tests/end-to-end/mock-objects/generator/nullable_union_type_return.phpt index 92b3316d278..eaf5e2af433 100644 --- a/tests/end-to-end/mock-objects/generator/nullable_union_type_return.phpt +++ b/tests/end-to-end/mock-objects/generator/nullable_union_type_return.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( Foo::class, true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/parameter_dnf.phpt b/tests/end-to-end/mock-objects/generator/parameter_dnf.phpt index 261b70b58aa..c3434356669 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_dnf.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_dnf.phpt @@ -1,10 +1,5 @@ --TEST-- \PHPUnit\Framework\MockObject\Generator\Generator::generate('Foo', [], 'MockFoo', true, true) ---SKIPIF-- -')) { - print 'skip: PHP 8.2 is required.'; -} --FILE-- generate( Foo::class, true, + true, [], 'MockFoo', true, @@ -43,6 +39,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/parameter_false.phpt b/tests/end-to-end/mock-objects/generator/parameter_false.phpt index 3235a3e6ce4..e33e0ba13fe 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_false.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_false.phpt @@ -1,10 +1,5 @@ --TEST-- \PHPUnit\Framework\MockObject\Generator\Generator::generate('Foo', [], 'MockFoo', true, true) ---SKIPIF-- -')) { - print 'skip: PHP 8.2 is required.'; -} --FILE-- generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -33,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/parameter_intersection.phpt b/tests/end-to-end/mock-objects/generator/parameter_intersection.phpt index fc839ad9af5..bd0655a1f66 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_intersection.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_intersection.phpt @@ -24,6 +24,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( Foo::class, true, + true, [], 'MockFoo', true, @@ -38,6 +39,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/parameter_null.phpt b/tests/end-to-end/mock-objects/generator/parameter_null.phpt index 8acaa1a27bb..8bc21a8a582 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_null.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_null.phpt @@ -1,10 +1,5 @@ --TEST-- \PHPUnit\Framework\MockObject\Generator\Generator::generate('Foo', [], 'MockFoo', true, true) ---SKIPIF-- -')) { - print 'skip: PHP 8.2 is required.'; -} --FILE-- generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -33,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/parameter_true.phpt b/tests/end-to-end/mock-objects/generator/parameter_true.phpt index 5856d2e77af..326d30e02d2 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_true.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_true.phpt @@ -1,10 +1,5 @@ --TEST-- \PHPUnit\Framework\MockObject\Generator\Generator::generate('Foo', [], 'MockFoo', true, true) ---SKIPIF-- -')) { - print 'skip: PHP 8.2 is required.'; -} --FILE-- generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -33,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/parameter_union.phpt b/tests/end-to-end/mock-objects/generator/parameter_union.phpt index cdca80927b2..261f6a89d55 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_union.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_union.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( Foo::class, true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/proxy.phpt b/tests/end-to-end/mock-objects/generator/proxy.phpt index 956c1087047..3b1d00864cd 100644 --- a/tests/end-to-end/mock-objects/generator/proxy.phpt +++ b/tests/end-to-end/mock-objects/generator/proxy.phpt @@ -18,7 +18,7 @@ require_once __DIR__ . '/../../../bootstrap.php'; $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( - 'Foo', true, [], 'ProxyFoo', true, true, true, true + 'Foo', true, true, [], 'ProxyFoo', true, true, true, true ); print $mock->classCode(); @@ -29,6 +29,7 @@ class ProxyFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInt { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt index 4137fccd46d..e599204d9ae 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt @@ -14,6 +14,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -28,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_dnf.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_dnf.phpt index da1ccc6ea2f..c14b85f22fe 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_dnf.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_dnf.phpt @@ -1,10 +1,5 @@ --TEST-- \PHPUnit\Framework\MockObject\Generator\Generator::generate('Foo', [], 'MockFoo', true, true) ---SKIPIF-- -')) { - print 'skip: PHP 8.2 is required.'; -} --FILE-- generate( Foo::class, true, + true, [], 'MockFoo', true, @@ -43,6 +39,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_false.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_false.phpt index bc6084f3e77..704326d9da2 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_false.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_false.phpt @@ -1,10 +1,5 @@ --TEST-- \PHPUnit\Framework\MockObject\Generator\Generator::generate('Foo', [], 'MockFoo', true, true) ---SKIPIF-- -')) { - print 'skip: PHP 8.2 is required.'; -} --FILE-- generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -33,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt index f8bc3f9a69f..59d105ef3b6 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt @@ -21,6 +21,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -35,6 +36,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt index 1ec09428c44..11bd536613d 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt @@ -14,6 +14,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -28,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_generator_empty_by_default.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_generator_empty_by_default.phpt index 9196dbf1382..01e328e8a7d 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_generator_empty_by_default.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_generator_empty_by_default.phpt @@ -13,7 +13,7 @@ require_once __DIR__ . '/../../../bootstrap.php'; $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; -$mock = $generator->testDouble('Foo', false); +$mock = $generator->testDouble('Foo', false, false); var_dump(iterator_to_array($mock->forTraversable())); var_dump(iterator_to_array($mock->forGenerator())); diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_intersection.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_intersection.phpt index 92ff1044b57..2fc91062941 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_intersection.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_intersection.phpt @@ -24,6 +24,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( Foo::class, true, + true, [], 'MockFoo', true, @@ -38,6 +39,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_never.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_never.phpt index 69457fe3a6e..8f63aef5512 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_never.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_never.phpt @@ -14,6 +14,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -28,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_null.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_null.phpt index 5de62db8663..45969d60b36 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_null.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_null.phpt @@ -1,10 +1,5 @@ --TEST-- \PHPUnit\Framework\MockObject\Generator\Generator::generate('Foo', [], 'MockFoo', true, true) ---SKIPIF-- -')) { - print 'skip: PHP 8.2 is required.'; -} --FILE-- generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -33,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt index 37ea58b586e..df601f93294 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt @@ -14,6 +14,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -28,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt index c05df39d0f8..fa756b3ce86 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt @@ -17,6 +17,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -31,6 +32,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt index d10e86e8ff9..63dbfaee54e 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt @@ -21,6 +21,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Bar', true, + true, [], 'MockBar', true, @@ -35,6 +36,7 @@ class MockBar extends Bar implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt index 213adfe7ff5..20f8c3f504f 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt @@ -14,6 +14,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -28,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_static.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_static.phpt index 106e098b0ee..7ff19e1e243 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_static.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_static.phpt @@ -24,6 +24,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'ClassWithStaticReturnTypes', true, + true, [], 'MockClassWithStaticReturnTypes', true, @@ -38,6 +39,7 @@ class MockClassWithStaticReturnTypes extends ClassWithStaticReturnTypes implemen { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_static_method.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_static_method.phpt index 0311ecee4d2..156026a34e7 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_static_method.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_static_method.phpt @@ -17,6 +17,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -31,6 +32,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_true.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_true.phpt index ee7d054aa44..3c8ab7e4934 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_true.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_true.phpt @@ -1,10 +1,5 @@ --TEST-- \PHPUnit\Framework\MockObject\Generator\Generator::generate('Foo', [], 'MockFoo', true, true) ---SKIPIF-- -')) { - print 'skip: PHP 8.2 is required.'; -} --FILE-- generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -33,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_union.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_union.phpt index 50fb050b68d..2fe38765905 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_union.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_union.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( Foo::class, true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt index 1b334f49f34..1a98b16b5ca 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt @@ -14,6 +14,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -28,6 +29,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt b/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt index 6c1d2e7ebf0..52e54a028fc 100644 --- a/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt +++ b/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt @@ -16,6 +16,7 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator; $mock = $generator->generate( 'Foo', true, + true, [], 'MockFoo', true, @@ -30,6 +31,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte { use PHPUnit\Framework\MockObject\StubApi; use PHPUnit\Framework\MockObject\MockObjectApi; + use PHPUnit\Framework\MockObject\GeneratedAsMockObject; use PHPUnit\Framework\MockObject\Method; use PHPUnit\Framework\MockObject\DoubledCloneMethod; diff --git a/tests/end-to-end/regression/5288/Issue5288Test.php b/tests/end-to-end/regression/5288/Issue5288Test.php index e909c5e3592..e7549aa989d 100644 --- a/tests/end-to-end/regression/5288/Issue5288Test.php +++ b/tests/end-to-end/regression/5288/Issue5288Test.php @@ -7,6 +7,8 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ +namespace PHPUnit\TestFixture\Issue5288; + use PHPUnit\Framework\TestCase; final class Issue5288Test extends TestCase diff --git a/tests/unit/Event/Events/Test/Issue/DeprecationTriggeredTest.php b/tests/unit/Event/Events/Test/Issue/DeprecationTriggeredTest.php index c0327243b12..f91097acc6a 100644 --- a/tests/unit/Event/Events/Test/Issue/DeprecationTriggeredTest.php +++ b/tests/unit/Event/Events/Test/Issue/DeprecationTriggeredTest.php @@ -27,6 +27,7 @@ public function testConstructorSetsValues(): void $line = 1; $suppressed = false; $ignoredByBaseline = false; + $ignoredByTest = false; $event = new DeprecationTriggered( $telemetryInfo, @@ -36,6 +37,7 @@ public function testConstructorSetsValues(): void $line, $suppressed, $ignoredByBaseline, + $ignoredByTest, ); $this->assertSame($telemetryInfo, $event->telemetryInfo()); @@ -45,6 +47,7 @@ public function testConstructorSetsValues(): void $this->assertSame($line, $event->line()); $this->assertSame($suppressed, $event->wasSuppressed()); $this->assertSame($ignoredByBaseline, $event->ignoredByBaseline()); + $this->assertSame($ignoredByTest, $event->ignoredByTest()); $this->assertSame('Test Triggered Deprecation (FooTest::testBar)' . PHP_EOL . 'message', $event->asString()); } @@ -58,12 +61,30 @@ public function testCanBeIgnoredByBaseline(): void 1, false, true, + false, ); $this->assertTrue($event->ignoredByBaseline()); $this->assertSame('Test Triggered Baseline-Ignored Deprecation (FooTest::testBar)' . PHP_EOL . 'message', $event->asString()); } + public function testCanBeIgnoredByTest(): void + { + $event = new DeprecationTriggered( + $this->telemetryInfo(), + $this->testValueObject(), + 'message', + 'file', + 1, + false, + false, + true, + ); + + $this->assertTrue($event->ignoredByTest()); + $this->assertSame('Test Triggered Test-Ignored Deprecation (FooTest::testBar)' . PHP_EOL . 'message', $event->asString()); + } + public function testCanBeSuppressed(): void { $event = new DeprecationTriggered( @@ -74,6 +95,7 @@ public function testCanBeSuppressed(): void 1, true, false, + false, ); $this->assertTrue($event->wasSuppressed()); diff --git a/tests/unit/Event/Events/Test/Issue/PhpDeprecationTriggeredTest.php b/tests/unit/Event/Events/Test/Issue/PhpDeprecationTriggeredTest.php index eec5479f8e2..becc988ba68 100644 --- a/tests/unit/Event/Events/Test/Issue/PhpDeprecationTriggeredTest.php +++ b/tests/unit/Event/Events/Test/Issue/PhpDeprecationTriggeredTest.php @@ -27,6 +27,7 @@ public function testConstructorSetsValues(): void $line = 1; $suppressed = false; $ignoredByBaseline = false; + $ignoredByTest = false; $event = new PhpDeprecationTriggered( $telemetryInfo, @@ -36,6 +37,7 @@ public function testConstructorSetsValues(): void $line, $suppressed, $ignoredByBaseline, + $ignoredByTest, ); $this->assertSame($telemetryInfo, $event->telemetryInfo()); @@ -45,6 +47,7 @@ public function testConstructorSetsValues(): void $this->assertSame($line, $event->line()); $this->assertSame($suppressed, $event->wasSuppressed()); $this->assertSame($ignoredByBaseline, $event->ignoredByBaseline()); + $this->assertSame($ignoredByTest, $event->ignoredByTest()); $this->assertSame('Test Triggered PHP Deprecation (FooTest::testBar)' . PHP_EOL . 'message', $event->asString()); } @@ -58,12 +61,30 @@ public function testCanBeIgnoredByBaseline(): void 1, false, true, + false, ); $this->assertTrue($event->ignoredByBaseline()); $this->assertSame('Test Triggered Baseline-Ignored PHP Deprecation (FooTest::testBar)' . PHP_EOL . 'message', $event->asString()); } + public function testCanBeIgnoredByTest(): void + { + $event = new PhpDeprecationTriggered( + $this->telemetryInfo(), + $this->testValueObject(), + 'message', + 'file', + 1, + false, + false, + true, + ); + + $this->assertTrue($event->ignoredByTest()); + $this->assertSame('Test Triggered Test-Ignored PHP Deprecation (FooTest::testBar)' . PHP_EOL . 'message', $event->asString()); + } + public function testCanBeSuppressed(): void { $event = new PhpDeprecationTriggered( @@ -74,6 +95,7 @@ public function testCanBeSuppressed(): void 1, true, false, + false, ); $this->assertTrue($event->wasSuppressed()); diff --git a/tests/unit/Framework/AssertTest.php b/tests/unit/Framework/AssertTest.php index e44984edbd4..2b35f55bee4 100644 --- a/tests/unit/Framework/AssertTest.php +++ b/tests/unit/Framework/AssertTest.php @@ -36,6 +36,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Small; use PHPUnit\TestFixture\Author; use PHPUnit\TestFixture\Book; @@ -1224,6 +1225,7 @@ public function testAssertStringMatchesFormatFailure(): void $this->assertStringMatchesFormat('*%s*', '**'); } + #[IgnorePhpunitDeprecations] public function testAssertStringNotMatchesFormat(): void { $this->assertStringNotMatchesFormat('*%s*', '**'); @@ -1561,6 +1563,7 @@ public function testAssertStringMatchesFormatFile(): void $this->assertStringMatchesFormatFile(TEST_FILES_PATH . 'expectedFileFormat.txt', "BAR\n"); } + #[IgnorePhpunitDeprecations] public function testAssertStringNotMatchesFormatFile(): void { $this->assertStringNotMatchesFormatFile(TEST_FILES_PATH . 'expectedFileFormat.txt', "BAR\n"); diff --git a/tests/unit/Framework/Constraint/Equality/IsEqualTest.php b/tests/unit/Framework/Constraint/Equality/IsEqualTest.php index eaa5573b0e1..46a124fcb23 100644 --- a/tests/unit/Framework/Constraint/Equality/IsEqualTest.php +++ b/tests/unit/Framework/Constraint/Equality/IsEqualTest.php @@ -326,13 +326,6 @@ public function testCanBeRepresentedAsString(bool $result, string $constraintAsS $this->assertStringMatchesFormat($constraintAsString, $constraint->toString(true)); } - public function testCanBeRepresentedAsStringWhenDeltaIsUsed(): void - { - $constraint = new IsEqual(0.0, 0.1); - - $this->assertSame('is equal to 0.0 with delta <0.100000>', $constraint->toString(true)); - } - public function testIsCountable(): void { $this->assertCount(1, (new IsEqual(true))); diff --git a/tests/unit/Framework/MockObject/Creation/CreateMockTest.php b/tests/unit/Framework/MockObject/Creation/CreateMockTest.php index 08a0b18b9e0..dcf60803c94 100644 --- a/tests/unit/Framework/MockObject/Creation/CreateMockTest.php +++ b/tests/unit/Framework/MockObject/Creation/CreateMockTest.php @@ -11,7 +11,6 @@ use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Medium; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\MockObject\Generator\ClassIsEnumerationException; use PHPUnit\Framework\MockObject\Generator\ClassIsFinalException; @@ -53,7 +52,6 @@ public function testCannotCreateMockObjectForFinalClass(): void $this->createMock(FinalClass::class); } - #[RequiresPhp('8.2')] public function testCannotCreateMockObjectForReadonlyClass(): void { $this->expectException(ClassIsReadonlyException::class); diff --git a/tests/unit/Framework/MockObject/Creation/CreateStubTest.php b/tests/unit/Framework/MockObject/Creation/CreateStubTest.php index 366151e2a7b..7769b59bd4a 100644 --- a/tests/unit/Framework/MockObject/Creation/CreateStubTest.php +++ b/tests/unit/Framework/MockObject/Creation/CreateStubTest.php @@ -11,14 +11,12 @@ use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Medium; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\MockObject\Generator\ClassIsEnumerationException; use PHPUnit\Framework\MockObject\Generator\ClassIsFinalException; use PHPUnit\Framework\MockObject\Generator\ClassIsReadonlyException; use PHPUnit\Framework\TestCase; use PHPUnit\TestFixture\MockObject\AnInterface; -use PHPUnit\TestFixture\MockObject\AnotherInterface; use PHPUnit\TestFixture\MockObject\Enumeration; use PHPUnit\TestFixture\MockObject\ExtendableClass; use PHPUnit\TestFixture\MockObject\FinalClass; @@ -39,15 +37,6 @@ public function testCreatesTestStubForInterface(): void $this->assertInstanceOf(Stub::class, $double); } - public function testCreatesTestStubForIntersectionOfInterfaces(): void - { - $double = $this->createStubForIntersectionOfInterfaces([AnInterface::class, AnotherInterface::class]); - - $this->assertInstanceOf(AnInterface::class, $double); - $this->assertInstanceOf(AnotherInterface::class, $double); - $this->assertInstanceOf(Stub::class, $double); - } - public function testCreatesTestStubForExtendableClass(): void { $double = $this->createStub(ExtendableClass::class); @@ -63,7 +52,6 @@ public function testCannotCreateTestStubForFinalClass(): void $this->createStub(FinalClass::class); } - #[RequiresPhp('8.2')] public function testCannotCreateTestStubForReadonlyClass(): void { $this->expectException(ClassIsReadonlyException::class); diff --git a/tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php b/tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php index fcfc5cbb5eb..9ca8cd00720 100644 --- a/tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php +++ b/tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php @@ -11,6 +11,7 @@ use function assert; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; @@ -21,6 +22,7 @@ #[Group('test-doubles/test-proxy')] #[Medium] #[TestDox('createTestProxy()')] +#[IgnorePhpunitDeprecations] final class CreateTestProxyTest extends TestCase { public function testCreatesTestProxyForExtendableClass(): void diff --git a/tests/unit/Framework/MockObject/Creation/GetMockForAbstractClassTest.php b/tests/unit/Framework/MockObject/Creation/GetMockForAbstractClassTest.php index 0ca964a0c2e..7a545ac808d 100644 --- a/tests/unit/Framework/MockObject/Creation/GetMockForAbstractClassTest.php +++ b/tests/unit/Framework/MockObject/Creation/GetMockForAbstractClassTest.php @@ -10,6 +10,7 @@ namespace PHPUnit\Framework\MockObject; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\Attributes\TestDox; @@ -24,6 +25,7 @@ #[Medium] #[RequiresPhpExtension('soap')] #[TestDox('getMockForAbstractClass()')] +#[IgnorePhpunitDeprecations] final class GetMockForAbstractClassTest extends TestCase { public function testCreatesMockObjectForAbstractClassAndAllowsConfigurationOfAbstractMethods(): void diff --git a/tests/unit/Framework/MockObject/Creation/GetMockForTraitTest.php b/tests/unit/Framework/MockObject/Creation/GetMockForTraitTest.php index fc944d00200..92343d0c30b 100644 --- a/tests/unit/Framework/MockObject/Creation/GetMockForTraitTest.php +++ b/tests/unit/Framework/MockObject/Creation/GetMockForTraitTest.php @@ -10,6 +10,7 @@ namespace PHPUnit\Framework\MockObject; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\MockObject\Generator\UnknownTraitException; @@ -21,6 +22,7 @@ #[Group('test-doubles/mock-object')] #[Medium] #[TestDox('getMockForTrait()')] +#[IgnorePhpunitDeprecations] final class GetMockForTraitTest extends TestCase { public function testCreatesMockObjectForTraitAndAllowsConfigurationOfAbstractMethods(): void diff --git a/tests/unit/Framework/MockObject/Creation/GetMockFromWsdlTest.php b/tests/unit/Framework/MockObject/Creation/GetMockFromWsdlTest.php index e5df4631f08..6f517217481 100644 --- a/tests/unit/Framework/MockObject/Creation/GetMockFromWsdlTest.php +++ b/tests/unit/Framework/MockObject/Creation/GetMockFromWsdlTest.php @@ -10,6 +10,7 @@ namespace PHPUnit\Framework\MockObject; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\Attributes\TestDox; @@ -21,6 +22,7 @@ #[Medium] #[RequiresPhpExtension('soap')] #[TestDox('getMockFromWsdl()')] +#[IgnorePhpunitDeprecations] final class GetMockFromWsdlTest extends TestCase { #[TestDox('Creates mock object from WSDL file')] diff --git a/tests/unit/Framework/MockObject/Creation/GetObjectForTraitTest.php b/tests/unit/Framework/MockObject/Creation/GetObjectForTraitTest.php index ff1dc197001..3c90fb3c0ac 100644 --- a/tests/unit/Framework/MockObject/Creation/GetObjectForTraitTest.php +++ b/tests/unit/Framework/MockObject/Creation/GetObjectForTraitTest.php @@ -10,6 +10,7 @@ namespace PHPUnit\Framework\MockObject; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\MockObject\Generator\UnknownTraitException; @@ -20,13 +21,14 @@ #[Group('test-doubles/creation')] #[Medium] #[TestDox('getObjectForTrait()')] +#[IgnorePhpunitDeprecations] final class GetObjectForTraitTest extends TestCase { public function testCreatesObjectForTrait(): void { $object = $this->getObjectForTrait(TraitWithConcreteMethod::class); - $this->assertTrue($object->method()); + $this->assertTrue($object->doSomething()); } public function testCannotCreateObjectForTraitThatDoesNotExist(): void diff --git a/tests/unit/Framework/MockObject/Creation/MockBuilderTest.php b/tests/unit/Framework/MockObject/Creation/MockBuilderTest.php index 0b08e4f3dbc..67f8297d947 100644 --- a/tests/unit/Framework/MockObject/Creation/MockBuilderTest.php +++ b/tests/unit/Framework/MockObject/Creation/MockBuilderTest.php @@ -13,6 +13,7 @@ use function mt_rand; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\TestCase; use PHPUnit\TestFixture\MockObject\ExtendableClass; @@ -37,6 +38,7 @@ public function testCanCreateMockObjectWithSpecifiedClassName(): void $this->assertSame($className, $double::class); } + #[IgnorePhpunitDeprecations] public function testCanCreateMockObjectForExtendableClassWhileAddingMethodsToIt(): void { $double = $this->getMockBuilder(ExtendableClass::class) @@ -50,6 +52,7 @@ public function testCanCreateMockObjectForExtendableClassWhileAddingMethodsToIt( $this->assertSame($value, $double->additionalMethod()); } + #[IgnorePhpunitDeprecations] public function testCannotCreateMockObjectForExtendableClassAddingMethodsToItThatItAlreadyHas(): void { $this->expectException(CannotUseAddMethodsException::class); diff --git a/tests/unit/Framework/MockObject/MockObjectTest.php b/tests/unit/Framework/MockObject/MockObjectTest.php index 0c518460e5c..be1cbef86db 100644 --- a/tests/unit/Framework/MockObject/MockObjectTest.php +++ b/tests/unit/Framework/MockObject/MockObjectTest.php @@ -12,7 +12,9 @@ use function call_user_func_array; use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\Medium; +use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; use PHPUnit\TestFixture\MockObject\AnInterface; @@ -22,6 +24,7 @@ #[Group('test-doubles')] #[Group('test-doubles/mock-object')] +#[TestDox('Mock Object')] #[Medium] final class MockObjectTest extends TestDoubleTestCase { @@ -416,6 +419,16 @@ public function testExpectationsCannotHaveDuplicateIds(): void $this->fail(); } + #[IgnorePhpunitDeprecations] + public function testExpectationsCanBeConfiguredOnTestStubs(): void + { + $mock = $this->createStub(AnInterface::class); + + $mock->expects($this->never())->method('doSomething'); + + $this->assertTrue(true); + } + /** * @psalm-param class-string $type */ diff --git a/tests/unit/Framework/MockObject/ReturnValueGeneratorTest.php b/tests/unit/Framework/MockObject/ReturnValueGeneratorTest.php index fd3132cc393..175c360fd44 100644 --- a/tests/unit/Framework/MockObject/ReturnValueGeneratorTest.php +++ b/tests/unit/Framework/MockObject/ReturnValueGeneratorTest.php @@ -7,7 +7,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace unit\Framework\MockObject; +namespace PHPUnit\Framework\MockObject; use function assert; use function interface_exists; @@ -18,8 +18,6 @@ use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Small; use PHPUnit\Framework\Attributes\TestDox; -use PHPUnit\Framework\MockObject\ReturnValueGenerator; -use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use PHPUnit\TestFixture\MockObject\AnInterface; use PHPUnit\TestFixture\MockObject\AnotherInterface; @@ -47,7 +45,7 @@ public static function unionProvider(): array ]; } - public function test_Generates_null_for_empty_string(): void + public function test_Generates_null_for_missing_return_type_declaration(): void { $this->assertNull($this->generate('')); } diff --git a/tests/unit/Framework/MockObject/TestDoubleTestCase.php b/tests/unit/Framework/MockObject/TestDoubleTestCase.php index d1c8f6e6d9f..aa4142ab3ac 100644 --- a/tests/unit/Framework/MockObject/TestDoubleTestCase.php +++ b/tests/unit/Framework/MockObject/TestDoubleTestCase.php @@ -10,10 +10,13 @@ namespace PHPUnit\Framework\MockObject; use Exception; +use PHPUnit\Framework\Attributes\IgnorePhpunitDeprecations; use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; use PHPUnit\TestFixture\MockObject\ExtendableClassWithCloneMethod; use PHPUnit\TestFixture\MockObject\InterfaceWithMethodThatExpectsObject; +use PHPUnit\TestFixture\MockObject\InterfaceWithMethodThatHasDefaultParameterValues; +use PHPUnit\TestFixture\MockObject\InterfaceWithNeverReturningMethod; use PHPUnit\TestFixture\MockObject\InterfaceWithReturnTypeDeclaration; use stdClass; @@ -34,6 +37,7 @@ final public function testMethodReturnsGeneratedValueWhenReturnValueGenerationIs } #[TestDox('__toString() method returns empty string when return value generation is disabled and no return value is configured')] + #[IgnorePhpunitDeprecations] final public function testToStringMethodReturnsEmptyStringWhenReturnValueGenerationIsDisabledAndNoReturnValueIsConfigured(): void { $double = $this->getMockBuilder(InterfaceWithReturnTypeDeclaration::class) @@ -43,6 +47,7 @@ final public function testToStringMethodReturnsEmptyStringWhenReturnValueGenerat $this->assertSame('', $double->__toString()); } + #[IgnorePhpunitDeprecations] final public function testMethodDoesNotReturnValueWhenReturnValueGenerationIsDisabledAndNoReturnValueIsConfigured(): void { $double = $this->getMockBuilder(InterfaceWithReturnTypeDeclaration::class) @@ -84,6 +89,7 @@ public function testObjectsPassedAsArgumentAreNotClonedByDefault(): void $this->assertSame($object, $double->doSomething($object)); } + #[IgnorePhpunitDeprecations] public function testCloningOfObjectsPassedAsArgumentCanBeEnabled(): void { $object = new stdClass; @@ -136,6 +142,26 @@ final public function testMethodCanBeConfiguredToReturnValuesBasedOnArgumentMapp $this->assertSame(4, $double->doSomethingElse(3)); } + final public function testMethodWithDefaultParameterValuesCanBeConfiguredToReturnValuesBasedOnArgumentMapping(): void + { + $double = $this->createTestDouble(InterfaceWithMethodThatHasDefaultParameterValues::class); + + $double->method('doSomething')->willReturnMap([[1, 2, 3], [4, 5, 6]]); + + $this->assertSame(3, $double->doSomething(1, 2)); + $this->assertSame(6, $double->doSomething(4, 5)); + } + + final public function testMethodWithDefaultParameterValuesCanBeConfiguredToReturnValuesBasedOnArgumentMappingThatOmitsDefaultValues(): void + { + $double = $this->createTestDouble(InterfaceWithMethodThatHasDefaultParameterValues::class); + + $double->method('doSomething')->willReturnMap([[1, 2], [3, 4]]); + + $this->assertSame(2, $double->doSomething(1)); + $this->assertSame(4, $double->doSomething(3)); + } + final public function testMethodCanBeConfiguredToReturnValuesUsingCallback(): void { $double = $this->createTestDouble(InterfaceWithReturnTypeDeclaration::class); @@ -203,16 +229,26 @@ final public function testMethodCanBeConfiguredToThrowAnException(): void $this->fail(); } + final public function testMethodWithNeverReturnTypeDeclarationThrowsException(): void + { + $double = $this->createTestDouble(InterfaceWithNeverReturningMethod::class); + + $this->expectException(NeverReturningMethodException::class); + $this->expectExceptionMessage('Method PHPUnit\TestFixture\MockObject\InterfaceWithNeverReturningMethod::m() is declared to never return'); + + $double->m(); + } + #[TestDox('Original __clone() method is not called by default when test double object is cloned')] - public function testOriginalCloneMethodIsNotCalledByDefaultWhenTestDoubleObjectIsCloned(): void + final public function testOriginalCloneMethodIsNotCalledByDefaultWhenTestDoubleObjectIsCloned(): void { $double = clone $this->createTestDouble(ExtendableClassWithCloneMethod::class); - $this->assertFalse($double->method()); + $this->assertFalse($double->doSomething()); } #[TestDox('Original __clone() method can optionally be called when test double object is cloned')] - public function testOriginalCloneMethodCanOptionallyBeCalledWhenTestDoubleObjectIsCloned(): void + final public function testOriginalCloneMethodCanOptionallyBeCalledWhenTestDoubleObjectIsCloned(): void { $double = $this->getMockBuilder(ExtendableClassWithCloneMethod::class)->enableOriginalClone()->getMock(); diff --git a/tests/unit/Metadata/Api/CodeCoverageTest.php b/tests/unit/Metadata/Api/CodeCoverageTest.php index a704354dc72..19f7db06551 100644 --- a/tests/unit/Metadata/Api/CodeCoverageTest.php +++ b/tests/unit/Metadata/Api/CodeCoverageTest.php @@ -16,7 +16,6 @@ use PHPUnit\Framework\Attributes\Small; use PHPUnit\Framework\CodeCoverageException; use PHPUnit\Framework\TestCase; -use PHPUnit\Framework\TestSuite; use PHPUnit\TestFixture\CoverageClassNothingTest; use PHPUnit\TestFixture\CoverageClassTest; use PHPUnit\TestFixture\CoverageClassWithoutAnnotationsTest; @@ -32,7 +31,6 @@ use PHPUnit\TestFixture\CoverageMethodTest; use PHPUnit\TestFixture\CoverageNamespacedFunctionTest; use PHPUnit\TestFixture\CoverageNoneTest; -use PHPUnit\TestFixture\IgnoringCodeUnitsTest; use PHPUnit\TestFixture\InterfaceTargetTest; use PHPUnit\TestFixture\InvalidClassTargetWithAnnotationTest; use PHPUnit\TestFixture\InvalidClassTargetWithAttributeTest; @@ -432,15 +430,4 @@ public function testRejectsInvalidUsesFunctionTarget(): void (new CodeCoverage)->linesToBeUsed(InvalidFunctionTargetTest::class, 'testOne'); } - - public function testCanIgnoreCodeUnits(): void - { - $this->assertSame( - [ - TEST_FILES_PATH . 'CoveredClass.php' => array_merge(range(12, 27), range(37, 41)), - TEST_FILES_PATH . 'CoveredFunction.php' => range(10, 12), - ], - (new CodeCoverage)->linesToBeIgnored(TestSuite::fromClassName(IgnoringCodeUnitsTest::class)), - ); - } } diff --git a/tests/unit/Metadata/MetadataCollectionTest.php b/tests/unit/Metadata/MetadataCollectionTest.php index eace75fc7b9..ba30ac3191a 100644 --- a/tests/unit/Metadata/MetadataCollectionTest.php +++ b/tests/unit/Metadata/MetadataCollectionTest.php @@ -34,9 +34,6 @@ #[UsesClass(DependsOnMethod::class)] #[UsesClass(DoesNotPerformAssertions::class)] #[UsesClass(Group::class)] -#[UsesClass(IgnoreClassForCodeCoverage::class)] -#[UsesClass(IgnoreMethodForCodeCoverage::class)] -#[UsesClass(IgnoreFunctionForCodeCoverage::class)] #[UsesClass(Metadata::class)] #[UsesClass(PostCondition::class)] #[UsesClass(PreCondition::class)] @@ -283,28 +280,12 @@ public function test_Can_be_filtered_for_Group(): void $this->assertTrue($collection->asArray()[0]->isGroup()); } - public function test_Can_be_filtered_for_IgnoreClassForCodeCoverage(): void + public function test_Can_be_filtered_for_IgnoreDeprecations(): void { - $collection = $this->collectionWithOneOfEach()->isIgnoreClassForCodeCoverage(); + $collection = $this->collectionWithOneOfEach()->isIgnoreDeprecations(); $this->assertCount(1, $collection); - $this->assertTrue($collection->asArray()[0]->isIgnoreClassForCodeCoverage()); - } - - public function test_Can_be_filtered_for_IgnoreMethodForCodeCoverage(): void - { - $collection = $this->collectionWithOneOfEach()->isIgnoreMethodForCodeCoverage(); - - $this->assertCount(1, $collection); - $this->assertTrue($collection->asArray()[0]->isIgnoreMethodForCodeCoverage()); - } - - public function test_Can_be_filtered_for_IgnoreFunctionForCodeCoverage(): void - { - $collection = $this->collectionWithOneOfEach()->isIgnoreFunctionForCodeCoverage(); - - $this->assertCount(1, $collection); - $this->assertTrue($collection->asArray()[0]->isIgnoreFunctionForCodeCoverage()); + $this->assertTrue($collection->asArray()[0]->isIgnoreDeprecations()); } public function test_Can_be_filtered_for_PostCondition(): void @@ -505,9 +486,7 @@ private function collectionWithOneOfEach(): MetadataCollection Metadata::excludeGlobalVariableFromBackupOnClass(''), Metadata::excludeStaticPropertyFromBackupOnClass('', ''), Metadata::groupOnClass(''), - Metadata::ignoreClassForCodeCoverage(''), - Metadata::ignoreMethodForCodeCoverage('', ''), - Metadata::ignoreFunctionForCodeCoverage(''), + Metadata::ignoreDeprecationsOnClass(), Metadata::postCondition(), Metadata::preCondition(), Metadata::preserveGlobalStateOnClass(true), diff --git a/tests/unit/Metadata/MetadataTest.php b/tests/unit/Metadata/MetadataTest.php index 3a004590be4..fb22586a68b 100644 --- a/tests/unit/Metadata/MetadataTest.php +++ b/tests/unit/Metadata/MetadataTest.php @@ -33,9 +33,7 @@ #[CoversClass(ExcludeGlobalVariableFromBackup::class)] #[CoversClass(ExcludeStaticPropertyFromBackup::class)] #[CoversClass(Group::class)] -#[CoversClass(IgnoreClassForCodeCoverage::class)] -#[CoversClass(IgnoreMethodForCodeCoverage::class)] -#[CoversClass(IgnoreFunctionForCodeCoverage::class)] +#[CoversClass(IgnoreDeprecations::class)] #[CoversClass(Metadata::class)] #[CoversClass(PostCondition::class)] #[CoversClass(PreCondition::class)] @@ -84,9 +82,7 @@ public function testCanBeAfter(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -133,9 +129,7 @@ public function testCanBeAfterClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -182,9 +176,7 @@ public function testCanBeBackupGlobalsOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -235,9 +227,7 @@ public function testCanBeBackupGlobalsOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -288,9 +278,7 @@ public function testCanBeBackupStaticPropertiesOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -341,9 +329,7 @@ public function testCanBeBackupStaticPropertiesOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -394,9 +380,7 @@ public function testCanBeBeforeClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -443,9 +427,7 @@ public function testCanBeBefore(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -492,9 +474,7 @@ public function testCanBeCoversOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -545,9 +525,7 @@ public function testCanBeCoversOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -598,9 +576,7 @@ public function testCanBeCoversClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -650,9 +626,7 @@ public function testCanBeCoversDefaultClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -701,9 +675,7 @@ public function testCanBeCoversFunction(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -753,9 +725,7 @@ public function testCanBeCoversNothingOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -805,9 +775,7 @@ public function testCanBeCoversNothingOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -857,9 +825,7 @@ public function testCanBeDataProvider(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -909,9 +875,7 @@ public function testCanBeDependsOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -962,9 +926,7 @@ public function testCanBeDependsOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1016,9 +978,7 @@ public function testCanBeDoesNotPerformAssertionsOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1068,9 +1028,7 @@ public function testCanBeDoesNotPerformAssertionsOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1120,9 +1078,7 @@ public function testCanBeExcludeGlobalVariableFromBackupOnClass(): void $this->assertTrue($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1173,9 +1129,7 @@ public function testCanBeExcludeGlobalVariableFromBackupOnMethod(): void $this->assertTrue($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1226,9 +1180,7 @@ public function testCanBeExcludeStaticPropertyFromBackupOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertTrue($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1280,9 +1232,7 @@ public function testCanBeExcludeStaticPropertyFromBackupOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertTrue($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1334,9 +1284,7 @@ public function testCanBeGroupOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertTrue($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1365,9 +1313,9 @@ public function testCanBeGroupOnClass(): void $this->assertFalse($metadata->isMethodLevel()); } - public function testCanBeIgnoreClassForCodeCoverage(): void + public function testCanBeIgnoreDeprecationsOnClass(): void { - $metadata = Metadata::ignoreClassForCodeCoverage('class'); + $metadata = Metadata::ignoreDeprecationsOnClass(); $this->assertFalse($metadata->isAfter()); $this->assertFalse($metadata->isAfterClass()); @@ -1387,9 +1335,7 @@ public function testCanBeIgnoreClassForCodeCoverage(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertTrue($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertTrue($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1412,69 +1358,11 @@ public function testCanBeIgnoreClassForCodeCoverage(): void $this->assertFalse($metadata->isUsesDefaultClass()); $this->assertFalse($metadata->isUsesFunction()); $this->assertFalse($metadata->isWithoutErrorHandler()); - - $this->assertSame('class', $metadata->className()); - $this->assertTrue($metadata->isClassLevel()); - $this->assertFalse($metadata->isMethodLevel()); - } - - public function testCanBeIgnoreMethodForCodeCoverage(): void - { - $metadata = Metadata::ignoreMethodForCodeCoverage('class', 'method'); - - $this->assertFalse($metadata->isAfter()); - $this->assertFalse($metadata->isAfterClass()); - $this->assertFalse($metadata->isBackupGlobals()); - $this->assertFalse($metadata->isBackupStaticProperties()); - $this->assertFalse($metadata->isBeforeClass()); - $this->assertFalse($metadata->isBefore()); - $this->assertFalse($metadata->isCovers()); - $this->assertFalse($metadata->isCoversClass()); - $this->assertFalse($metadata->isCoversDefaultClass()); - $this->assertFalse($metadata->isCoversFunction()); - $this->assertFalse($metadata->isCoversNothing()); - $this->assertFalse($metadata->isDataProvider()); - $this->assertFalse($metadata->isDependsOnClass()); - $this->assertFalse($metadata->isDependsOnMethod()); - $this->assertFalse($metadata->isDoesNotPerformAssertions()); - $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); - $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); - $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertTrue($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); - $this->assertFalse($metadata->isRunClassInSeparateProcess()); - $this->assertFalse($metadata->isRunInSeparateProcess()); - $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); - $this->assertFalse($metadata->isTest()); - $this->assertFalse($metadata->isPreCondition()); - $this->assertFalse($metadata->isPostCondition()); - $this->assertFalse($metadata->isPreserveGlobalState()); - $this->assertFalse($metadata->isRequiresMethod()); - $this->assertFalse($metadata->isRequiresFunction()); - $this->assertFalse($metadata->isRequiresOperatingSystem()); - $this->assertFalse($metadata->isRequiresOperatingSystemFamily()); - $this->assertFalse($metadata->isRequiresPhp()); - $this->assertFalse($metadata->isRequiresPhpExtension()); - $this->assertFalse($metadata->isRequiresPhpunit()); - $this->assertFalse($metadata->isRequiresSetting()); - $this->assertFalse($metadata->isTestDox()); - $this->assertFalse($metadata->isTestWith()); - $this->assertFalse($metadata->isUses()); - $this->assertFalse($metadata->isUsesClass()); - $this->assertFalse($metadata->isUsesDefaultClass()); - $this->assertFalse($metadata->isUsesFunction()); - $this->assertFalse($metadata->isWithoutErrorHandler()); - - $this->assertSame('class', $metadata->className()); - $this->assertSame('method', $metadata->methodName()); - $this->assertTrue($metadata->isClassLevel()); - $this->assertFalse($metadata->isMethodLevel()); } - public function testCanBeIgnoreFunctionForCodeCoverage(): void + public function testCanBeIgnoreDeprecationsOnMethod(): void { - $metadata = Metadata::ignoreFunctionForCodeCoverage('function'); + $metadata = Metadata::ignoreDeprecationsOnMethod(); $this->assertFalse($metadata->isAfter()); $this->assertFalse($metadata->isAfterClass()); @@ -1494,9 +1382,7 @@ public function testCanBeIgnoreFunctionForCodeCoverage(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertTrue($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertTrue($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1519,10 +1405,6 @@ public function testCanBeIgnoreFunctionForCodeCoverage(): void $this->assertFalse($metadata->isUsesDefaultClass()); $this->assertFalse($metadata->isUsesFunction()); $this->assertFalse($metadata->isWithoutErrorHandler()); - - $this->assertSame('function', $metadata->functionName()); - $this->assertTrue($metadata->isClassLevel()); - $this->assertFalse($metadata->isMethodLevel()); } public function testCanBeGroupOnMethod(): void @@ -1547,9 +1429,7 @@ public function testCanBeGroupOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertTrue($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1600,9 +1480,7 @@ public function testCanBeRunTestsInSeparateProcesses(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertTrue($metadata->isRunTestsInSeparateProcesses()); @@ -1649,9 +1527,7 @@ public function testCanBeRunClassInSeparateProcess(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertTrue($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1698,9 +1574,7 @@ public function testCanBeRunInSeparateProcess(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertTrue($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1747,9 +1621,7 @@ public function testCanBeTest(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1796,9 +1668,7 @@ public function testCanBePreCondition(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1845,9 +1715,7 @@ public function testCanBePostCondition(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1893,9 +1761,7 @@ public function testCanBePreserveGlobalStateOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1945,9 +1811,7 @@ public function testCanBePreserveGlobalStateOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -1998,9 +1862,7 @@ public function testCanBeRequiresMethodOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2052,9 +1914,7 @@ public function testCanBeRequiresMethodOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2106,9 +1966,7 @@ public function testCanBeRequiresFunctionOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2159,9 +2017,7 @@ public function testCanBeRequiresFunctionOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2212,9 +2068,7 @@ public function testCanBeRequiresOperatingSystemOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2265,9 +2119,7 @@ public function testCanBeRequiresOperatingSystemOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2318,9 +2170,7 @@ public function testCanBeRequiresOperatingSystemFamilyOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2371,9 +2221,7 @@ public function testCanBeRequiresOperatingSystemFamilyOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2429,9 +2277,7 @@ public function testCanBeRequiresPhpOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2488,9 +2334,7 @@ public function testCanBeRequiresPhpOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2542,9 +2386,7 @@ public function testCanBeRequiresPhpExtensionOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2606,9 +2448,7 @@ public function testCanBeRequiresPhpExtensionWithVersionOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2662,9 +2502,7 @@ public function testCanBeRequiresPhpExtensionOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2726,9 +2564,7 @@ public function testCanBeRequiresPhpExtensionWithVersionOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2787,9 +2623,7 @@ public function testCanBeRequiresPhpunitOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2846,9 +2680,7 @@ public function testCanBeRequiresPhpunitOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2900,9 +2732,7 @@ public function testCanBeRequiresSettingOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -2955,9 +2785,7 @@ public function testCanBeRequiresSettingOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3010,9 +2838,7 @@ public function testCanBeTestDoxOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3064,9 +2890,7 @@ public function testCanBeTestDoxOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3118,9 +2942,7 @@ public function testCanBeTestWith(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3169,9 +2991,7 @@ public function testCanBeUsesOnClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3223,9 +3043,7 @@ public function testCanBeUsesOnMethod(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3277,9 +3095,7 @@ public function testCanBeUsesClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3329,9 +3145,7 @@ public function testCanBeUsesDefaultClass(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3380,9 +3194,7 @@ public function testCanBeUsesFunction(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); @@ -3432,9 +3244,7 @@ public function testCanBeWithoutErrorHandler(): void $this->assertFalse($metadata->isExcludeGlobalVariableFromBackup()); $this->assertFalse($metadata->isExcludeStaticPropertyFromBackup()); $this->assertFalse($metadata->isGroup()); - $this->assertFalse($metadata->isIgnoreClassForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreMethodForCodeCoverage()); - $this->assertFalse($metadata->isIgnoreFunctionForCodeCoverage()); + $this->assertFalse($metadata->isIgnoreDeprecations()); $this->assertFalse($metadata->isRunClassInSeparateProcess()); $this->assertFalse($metadata->isRunInSeparateProcess()); $this->assertFalse($metadata->isRunTestsInSeparateProcesses()); diff --git a/tests/unit/Metadata/Parser/AttributeParserTest.php b/tests/unit/Metadata/Parser/AttributeParserTest.php index 0f3f7864e35..8054d440455 100644 --- a/tests/unit/Metadata/Parser/AttributeParserTest.php +++ b/tests/unit/Metadata/Parser/AttributeParserTest.php @@ -15,7 +15,6 @@ use PHPUnit\Framework\Attributes\BackupStaticProperties; use PHPUnit\Framework\Attributes\Before; use PHPUnit\Framework\Attributes\BeforeClass; -use PHPUnit\Framework\Attributes\CodeCoverageIgnore; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\CoversFunction; use PHPUnit\Framework\Attributes\CoversNothing; @@ -34,9 +33,6 @@ use PHPUnit\Framework\Attributes\ExcludeGlobalVariableFromBackup; use PHPUnit\Framework\Attributes\ExcludeStaticPropertyFromBackup; use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\IgnoreClassForCodeCoverage; -use PHPUnit\Framework\Attributes\IgnoreFunctionForCodeCoverage; -use PHPUnit\Framework\Attributes\IgnoreMethodForCodeCoverage; use PHPUnit\Framework\Attributes\Large; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\PostCondition; @@ -70,7 +66,6 @@ #[CoversClass(BackupStaticProperties::class)] #[CoversClass(BeforeClass::class)] #[CoversClass(Before::class)] -#[CoversClass(CodeCoverageIgnore::class)] #[CoversClass(CoversClass::class)] #[CoversClass(CoversFunction::class)] #[CoversClass(CoversNothing::class)] @@ -89,9 +84,6 @@ #[CoversClass(ExcludeGlobalVariableFromBackup::class)] #[CoversClass(ExcludeStaticPropertyFromBackup::class)] #[CoversClass(Group::class)] -#[CoversClass(IgnoreClassForCodeCoverage::class)] -#[CoversClass(IgnoreFunctionForCodeCoverage::class)] -#[CoversClass(IgnoreMethodForCodeCoverage::class)] #[CoversClass(Large::class)] #[CoversClass(Medium::class)] #[CoversClass(PostCondition::class)] diff --git a/tests/unit/Metadata/Parser/AttributeParserTestCase.php b/tests/unit/Metadata/Parser/AttributeParserTestCase.php index 57cdb872942..25a6797a4ee 100644 --- a/tests/unit/Metadata/Parser/AttributeParserTestCase.php +++ b/tests/unit/Metadata/Parser/AttributeParserTestCase.php @@ -24,7 +24,10 @@ use PHPUnit\TestFixture\Metadata\Attribute\DoesNotPerformAssertionsTest; use PHPUnit\TestFixture\Metadata\Attribute\Example; use PHPUnit\TestFixture\Metadata\Attribute\GroupTest; -use PHPUnit\TestFixture\Metadata\Attribute\IgnoreCodeCoverageTest; +use PHPUnit\TestFixture\Metadata\Attribute\IgnoreDeprecationsClassTest; +use PHPUnit\TestFixture\Metadata\Attribute\IgnoreDeprecationsMethodTest; +use PHPUnit\TestFixture\Metadata\Attribute\IgnorePhpunitDeprecationsClassTest; +use PHPUnit\TestFixture\Metadata\Attribute\IgnorePhpunitDeprecationsMethodTest; use PHPUnit\TestFixture\Metadata\Attribute\LargeTest; use PHPUnit\TestFixture\Metadata\Attribute\MediumTest; use PHPUnit\TestFixture\Metadata\Attribute\NonPhpunitAttributeTest; @@ -155,35 +158,22 @@ public function test_parses_Medium_attribute_on_class(): void $this->assertSame('medium', $metadata->asArray()[0]->groupName()); } - #[TestDox('Parses #[IgnoreClassForCodeCoverage] attribute on class')] - public function test_parses_IgnoreClassForCodeCoverage_attribute_on_class(): void + #[TestDox('Parses #[IgnoreDeprecations] attribute on class')] + public function test_parses_IgnoreDeprecations_attribute_on_class(): void { - $metadata = $this->parser()->forClass(IgnoreCodeCoverageTest::class)->isIgnoreClassForCodeCoverage(); + $metadata = $this->parser()->forClass(IgnoreDeprecationsClassTest::class)->isIgnoreDeprecations(); $this->assertCount(1, $metadata); - $this->assertTrue($metadata->asArray()[0]->isIgnoreClassForCodeCoverage()); - $this->assertSame('className', $metadata->asArray()[0]->className()); + $this->assertTrue($metadata->asArray()[0]->isIgnoreDeprecations()); } - #[TestDox('Parses #[IgnoreMethodForCodeCoverage] attribute on class')] - public function test_parses_IgnoreMethodForCodeCoverage_attribute_on_class(): void + #[TestDox('Parses #[IgnorePhpunitDeprecations] attribute on class')] + public function test_parses_IgnorePhpunitDeprecations_attribute_on_class(): void { - $metadata = $this->parser()->forClass(IgnoreCodeCoverageTest::class)->isIgnoreMethodForCodeCoverage(); + $metadata = $this->parser()->forClass(IgnorePhpunitDeprecationsClassTest::class)->isIgnorePhpunitDeprecations(); $this->assertCount(1, $metadata); - $this->assertTrue($metadata->asArray()[0]->isIgnoreMethodForCodeCoverage()); - $this->assertSame('ClassName', $metadata->asArray()[0]->className()); - $this->assertSame('methodName', $metadata->asArray()[0]->methodName()); - } - - #[TestDox('Parses #[IgnoreFunctionForCodeCoverage] attribute on class')] - public function test_parses_IgnoreFunctionForCodeCoverage_attribute_on_class(): void - { - $metadata = $this->parser()->forClass(IgnoreCodeCoverageTest::class)->isIgnoreFunctionForCodeCoverage(); - - $this->assertCount(1, $metadata); - $this->assertTrue($metadata->asArray()[0]->isIgnoreFunctionForCodeCoverage()); - $this->assertSame('functionName', $metadata->asArray()[0]->functionName()); + $this->assertTrue($metadata->asArray()[0]->isIgnorePhpunitDeprecations()); } #[TestDox('Parses #[PreserveGlobalState] attribute on class')] @@ -651,6 +641,24 @@ public function test_parses_Group_attribute_on_method(): void $this->assertSame('another-group', $metadata->asArray()[0]->groupName()); } + #[TestDox('Parses #[IgnoreDeprecations] attribute on method')] + public function test_parses_IgnoreDeprecations_attribute_on_method(): void + { + $metadata = $this->parser()->forMethod(IgnoreDeprecationsMethodTest::class, 'testOne')->isIgnoreDeprecations(); + + $this->assertCount(1, $metadata); + $this->assertTrue($metadata->asArray()[0]->isIgnoreDeprecations()); + } + + #[TestDox('Parses #[IgnorePhpunitDeprecations] attribute on method')] + public function test_parses_IgnorePhpunitDeprecations_attribute_on_method(): void + { + $metadata = $this->parser()->forMethod(IgnorePhpunitDeprecationsMethodTest::class, 'testOne')->isIgnorePhpunitDeprecations(); + + $this->assertCount(1, $metadata); + $this->assertTrue($metadata->asArray()[0]->isIgnorePhpunitDeprecations()); + } + #[TestDox('Parses #[PostCondition] attribute on method')] public function test_parses_PostCondition_attribute_on_method(): void { diff --git a/tests/unit/Runner/PhptTestCaseTest.php b/tests/unit/Runner/PhptTestCaseTest.php deleted file mode 100644 index 088d2e2a666..00000000000 --- a/tests/unit/Runner/PhptTestCaseTest.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -use function sys_get_temp_dir; -use function touch; -use function unlink; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Medium; -use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; -use PHPUnit\Util\PHP\AbstractPhpProcess; - -#[CoversClass(PhptTestCase::class)] -#[Medium] -final class PhptTestCaseTest extends TestCase -{ - private const EXPECT_CONTENT = <<<'EOF' ---TEST-- -EXPECT test ---FILE-- - ---EXPECT-- -Hello PHPUnit! -EOF; - private string $filename; - private ?PhptTestCase $testCase; - private null|AbstractPhpProcess|MockObject $phpProcess; - - protected function setUp(): void - { - $this->filename = sys_get_temp_dir() . '/phpunit.phpt'; - - touch($this->filename); - - $this->phpProcess = $this->getMockForAbstractClass(AbstractPhpProcess::class, [], '', false); - $this->testCase = new PhptTestCase($this->filename, $this->phpProcess); - } - - protected function tearDown(): void - { - @unlink($this->filename); - - $this->phpProcess = null; - $this->testCase = null; - } - - public function testAlwaysReportsNumberOfAssertionsIsOne(): void - { - $this->assertSame(1, $this->testCase->numberOfAssertionsPerformed()); - } - - public function testAlwaysReportsItDoesNotUseADataprovider(): void - { - $this->assertFalse($this->testCase->usesDataProvider()); - } - - public function testPHPTReturnsFilenameAsTestName(): void - { - $this->assertSame($this->filename, $this->testCase->getName()); - } - - public function testPHPTReturnsFilenameAsSortId(): void - { - $this->assertSame($this->filename, $this->testCase->sortId()); - } - - public function testPHPTDoesNotAffectDependencyResolution(): void - { - $this->assertSame([], $this->testCase->provides()); - $this->assertSame([], $this->testCase->requires()); - } -} diff --git a/tests/unit/Runner/TestSuiteSorterTest.php b/tests/unit/Runner/TestSuiteSorterTest.php index fe0a20d3c48..b56a0835b12 100644 --- a/tests/unit/Runner/TestSuiteSorterTest.php +++ b/tests/unit/Runner/TestSuiteSorterTest.php @@ -140,14 +140,14 @@ public static function orderDurationWithCacheProvider(): array } /** - * A @dataprovider for basic execution reordering options based on MultiDependencyTest. + * A data provider for basic execution reordering options based on MultiDependencyTest. * * This class has the following relevant properties: * - * - it has five tests 'testOne' ... 'testFive' - * - 'testThree' @depends on both 'testOne' and 'testTwo' - * - 'testFour' @depends on 'MultiDependencyTest::testThree' to test FQN @depends - * - 'testFive' has no dependencies + * - it has five tests testOne, testTwo, testThree, testFour, testFive + * - testThree depends on testOne and testTwo + * - testFour depends on MultiDependencyTest::testThree + * - testFive has no dependencies */ public static function commonSorterOptionsProvider(): array { @@ -206,14 +206,14 @@ public static function commonSorterOptionsProvider(): array } /** - * A @dataprovider for testing defects execution reordering options based on MultiDependencyTest. + * A data provider for testing defects execution reordering options based on MultiDependencyTest. * * This class has the following relevant properties: * - * - it has five tests 'testOne' ... 'testFive' - * - 'testThree' @depends on both 'testOne' and 'testTwo' - * - 'testFour' @depends on 'MultiDependencyTest::testThree' to test FQN @depends - * - 'testFive' has no dependencies + * - it has five tests testOne, testTwo, testThree, testFour, testFive + * - testThree depends on testOne and testTwo + * - testFour depends on MultiDependencyTest::testThree + * - testFive has no dependencies */ public static function defectsSorterOptionsProvider(): array { diff --git a/tests/unit/TextUI/Configuration/Xml/LoaderTest.php b/tests/unit/TextUI/Configuration/Xml/LoaderTest.php index 6878a49f67a..7ca282b1b6d 100644 --- a/tests/unit/TextUI/Configuration/Xml/LoaderTest.php +++ b/tests/unit/TextUI/Configuration/Xml/LoaderTest.php @@ -169,18 +169,11 @@ public function testCodeCoverageConfigurationIsReadCorrectly(): void { $codeCoverage = $this->configuration('configuration_codecoverage.xml')->codeCoverage(); - $this->assertSame('/tmp/cache', $codeCoverage->cacheDirectory()->path()); - $this->assertTrue($codeCoverage->pathCoverage()); $this->assertTrue($codeCoverage->includeUncoveredFiles()); $this->assertTrue($codeCoverage->ignoreDeprecatedCodeUnits()); $this->assertTrue($codeCoverage->disableCodeCoverageIgnore()); - $this->assertFalse($codeCoverage->directories()->notEmpty()); - $this->assertFalse($codeCoverage->files()->notEmpty()); - $this->assertFalse($codeCoverage->excludeDirectories()->notEmpty()); - $this->assertFalse($codeCoverage->excludeFiles()->notEmpty()); - $this->assertTrue($codeCoverage->hasClover()); $this->assertSame(TEST_FILES_PATH . 'clover.xml', $codeCoverage->clover()->target()->path()); diff --git a/tests/unit/Util/PHP/AbstractPhpProcessTest.php b/tests/unit/Util/PHP/AbstractPhpProcessTest.php deleted file mode 100644 index a32612dc670..00000000000 --- a/tests/unit/Util/PHP/AbstractPhpProcessTest.php +++ /dev/null @@ -1,114 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util\PHP; - -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Small; -use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; - -#[CoversClass(AbstractPhpProcess::class)] -#[Small] -final class AbstractPhpProcessTest extends TestCase -{ - private null|AbstractPhpProcess|MockObject $phpProcess; - - protected function setUp(): void - { - $this->phpProcess = $this->getMockForAbstractClass(AbstractPhpProcess::class); - } - - protected function tearDown(): void - { - $this->phpProcess = null; - } - - public function testShouldNotUseStderrRedirectionByDefault(): void - { - $this->assertFalse($this->phpProcess->useStderrRedirection()); - } - - public function testShouldDefinedIfUseStderrRedirection(): void - { - $this->phpProcess->setUseStderrRedirection(true); - - $this->assertTrue($this->phpProcess->useStderrRedirection()); - } - - public function testShouldDefinedIfDoNotUseStderrRedirection(): void - { - $this->phpProcess->setUseStderrRedirection(false); - - $this->assertFalse($this->phpProcess->useStderrRedirection()); - } - - public function testShouldUseGivenSettingsToCreateCommand(): void - { - $settings = [ - 'allow_url_fopen=1', - 'auto_append_file=', - 'display_errors=1', - ]; - - $expectedCommandFormat = '%s -d %callow_url_fopen=1%c -d %cauto_append_file=%c -d %cdisplay_errors=1%c%S'; - $actualCommand = $this->phpProcess->getCommand($settings); - - $this->assertStringMatchesFormat($expectedCommandFormat, $actualCommand); - } - - public function testShouldRedirectStderrToStdoutWhenDefined(): void - { - $this->phpProcess->setUseStderrRedirection(true); - - $expectedCommandFormat = '%s 2>&1'; - $actualCommand = $this->phpProcess->getCommand([]); - - $this->assertStringMatchesFormat($expectedCommandFormat, $actualCommand); - } - - public function testShouldUseArgsToCreateCommand(): void - { - $this->phpProcess->setArgs('foo=bar'); - - $expectedCommandFormat = '%s foo=bar'; - $actualCommand = $this->phpProcess->getCommand([]); - - $this->assertStringMatchesFormat($expectedCommandFormat, $actualCommand); - } - - public function testShouldHaveFileToCreateCommand(): void - { - $expectedCommandFormat = '%s %cfile.php%c'; - $actualCommand = $this->phpProcess->getCommand([], 'file.php'); - - $this->assertStringMatchesFormat($expectedCommandFormat, $actualCommand); - } - - public function testStdinGetterAndSetter(): void - { - $this->phpProcess->setStdin('foo'); - - $this->assertEquals('foo', $this->phpProcess->getStdin()); - } - - public function testArgsGetterAndSetter(): void - { - $this->phpProcess->setArgs('foo=bar'); - - $this->assertEquals('foo=bar', $this->phpProcess->getArgs()); - } - - public function testEnvGetterAndSetter(): void - { - $this->phpProcess->setEnv(['foo' => 'bar']); - - $this->assertEquals(['foo' => 'bar'], $this->phpProcess->getEnv()); - } -} diff --git a/tools/php-cs-fixer b/tools/php-cs-fixer index e246d40096c..2776418c472 100755 Binary files a/tools/php-cs-fixer and b/tools/php-cs-fixer differ diff --git a/tools/php-scoper b/tools/php-scoper index 1506c056a54..bb4f7834ade 100755 Binary files a/tools/php-scoper and b/tools/php-scoper differ