20 KiB
20 KiB
Changes in PHPUnit 11.5
All notable changes of the PHPUnit 11.5 release series are documented in this file using the Keep a CHANGELOG principles.
11.5.33 - 2025-08-16
Changed
- #6321: Allow
error_reporting=E_ALLfor--check-php-configuration
Fixed
- #5863: TestDox printer does not show previous exception
- #6102:
expectUserDeprecationMessage*()fails when test is run in separate process
11.5.32 - 2025-08-12
Changed
- #6308: Improve output of
--check-php-configuration - The version number for the test result cache file has been incremented to reflect that its structure for PHPUnit 11.5 is not compatible with its structure for PHPUnit 8.5 and PHPUnit 9.6
Fixed
- #6281: Exceptions raised in after-test method are not reported for skipped tests
11.5.31 - 2025-08-11
Fixed
- #6304: PHPUnit 11.5.29 hangs when a test runner deprecation is triggered and process isolation is used (this reverts "
#[IgnorePhpunitDeprecations]is now considered for test runner deprecations" from PHPUnit 11.5.29)
11.5.30 - 2025-08-10
Changed
- #6300: Emit warning when the name of a data provider method begins with
test - Do not use
SplObjectStoragemethods that will be deprecated in PHP 8.5
11.5.29 - 2025-08-09
Added
- #6297:
--check-php-configurationCLI option for checking whether PHP is configured for testing
Changed
#[IgnorePhpunitDeprecations]is now considered for test runner deprecations (where applicable)
Fixed
- #6160: Baseline file in a subdirectory contains absolute paths
- Errors due to invalid data provided using
#[TestWith]or#[TestWithJson]attributes are now properly reported - The
DataProviderMethodFinishedevent is now also emitted when the provided data set has an invalid key
11.5.28 - 2025-07-31
Fixed
- #6097: The
fileattribute of<testClass>node of XML test list can be wrong
11.5.27 - 2025-07-11
Fixed
- #6254:
defects,randomconfiguration is supported by implementation, but it is not allowed by the XML configuration file schema - #6259: Order of tests which use data from data providers is not affected by test sorting
- #6266: Superfluous whitespace in TestDox output when test method name has a number after the
testprefix
11.5.26 - 2025-07-04
Fixed
- #6104: Test with dependencies and data provider fails
- #6163:
@no-named-argumentsleads to static analysis errors for variadic arguments
11.5.25 - 2025-06-27
Fixed
- #6249: No meaningful error when
<testsuite>element is missing requirednameattribute
11.5.24 - 2025-06-20
Added
- #6236:
failOnPhpunitWarningattribute on the<phpunit>element of the XML configuration file and--fail-on-phpunit-warningCLI option for controlling whether PHPUnit should fail on PHPUnit warnings (default:true) - #6239:
--do-not-fail-on-deprecation,--do-not-fail-on-phpunit-warning,--do-not-fail-on-phpunit-deprecation,--do-not-fail-on-empty-test-suite,--do-not-fail-on-incomplete,--do-not-fail-on-notice,--do-not-fail-on-risky,--do-not-fail-on-skipped, and--do-not-fail-on-warningCLI options --do-not-report-useless-testsCLI option as a replacement for--dont-report-useless-tests
Deprecated
--dont-report-useless-testsCLI option (use--do-not-report-useless-testsinstead)
Fixed
- #6243: Constraints cannot be implemented without using internal class
ExpectationFailedException
11.5.23 - 2025-06-13
Fixed
- #6222: Data Provider seems to mess up Test Dependencies
shortenArraysForExportThresholdXML configuration setting has no effect on all arrays exported for event-related value objects
11.5.22 - 2025-06-06
Changed
- Do not treat warnings differently than other issues in summary section of default output
11.5.21 - 2025-05-21
Changed
- #6210: Set default Clover coverage project name
- #6217: Improve the error message when
createStubForIntersectionOfInterfaces()is called with a class
11.5.20 - 2025-05-11
Fixed
- #6192: Reverted change made in PHPUnit 11.5.19 due to regression
- #6199:
assertEmpty()andassertNotEmpty()use overly restrictivephpstan-assert emptydirectives
11.5.19 - 2025-05-02
Added
displayDetailsOnAllIssuesattribute on the<phpunit>element of the XML configuration file and--display-all-issuesCLI option for controlling whether PHPUnit should display details on all issues that are triggered (default:false)failOnAllIssuesattribute on the<phpunit>element of the XML configuration file and--fail-on-all-issuesCLI option for controlling whether PHPUnit should fail on all issues that are triggered (default:false)
Changed
- #5956: Improved handling of deprecated
E_STRICTconstant
Fixed
- #6192: Positive
%aand%Amatches are not ignored from diff whenEXPECTFfails
11.5.18 - 2025-04-22
Changed
- When gathering the telemetry information that each event has, the real size of memory allocated from the operating system is no longer used as this is grown by PHP's memory manager in chunks that are so large that small(er) increases in peak memory usage cannot be seen
- The peak memory usage returned by
memory_get_peak_usage()is now reset immediately before theTest\Preparedevent is emitted usingmemory_reset_peak_usage()so that (memory usage atTest\Finished- memory usage atTest\Prepared) is a better approximation of the memory usage of the test - The string representation of
Telemetry\Infonow uses peak memory usage instead of memory usage (this affects--log-events-verbose-text)
Fixed
- A "Before Test Method Errored" event is no longer emitted when a test is skipped in a "before test" method
11.5.17 - 2025-04-08
Fixed
- #6104: Reverted change introduced in PHPUnit 11.5.16
11.5.16 - 2025-04-08
Fixed
- #6104: Test with dependencies and data provider fails
- #6174:
willReturnMap()fails with nullable parameters when their default isnulland no argument is passed for them
11.5.15 - 2025-03-23
Changed
- #6150: Reverted change introduced in PHPUnit 11.5.13
11.5.14 - 2025-03-19
Changed
- Updated dependencies for PHAR distribution
11.5.13 - 2025-03-18
Changed
- #6150: Trigger warning when code coverage analysis is performed and no cache directory is configured
11.5.12 - 2025-03-07
Fixed
- #5976: TestDox result printer does not display details about errors triggered in before-first-test and after-last-test methods
11.5.11 - 2025-03-05
Fixed
- #6142:
$expectedand$actualare mixed up in failure description whenassertJsonFileEqualsJsonFile()fails
11.5.10 - 2025-02-25
Fixed
- #6138: Test with failed expectation on value passed to mocked method is incorrectly considered risky
11.5.9 - 2025-02-21
Fixed
- #6134: Missing event when child process ends unexpectedly
11.5.8 - 2025-02-18
Fixed
- A
Test\PreparationFailedevent is now emitted in addition to aTest\Erroredevent when an unexpected exception is triggered in a before-test method - A
Test\Passedevent is no longer emitted in addition to aTest\FailedorTest\Erroredevent when an assertion failure or an unexpected exception is triggered in an after-test method - A
TestSuite\Finishedevent is now emitted when a before-first-test method errors
11.5.7 - 2025-02-06
Changed
- #5951: The
includeUncoveredFilesconfiguration option is no longer deprecated - #6117: Include source location information for issues triggered during test in
--debugoutput - #6119: Improve message for errors that occur while parsing attributes
- #6120: Allow negative priorities for hook methods
11.5.6 - 2025-01-31
Changed
- #6112: Improve performance of
SourceMapper
Fixed
- #6115: Backed enumerations with values not of type
stringcannot be used in customized TestDox output
11.5.5 - 2025-01-29
Changed
- Do not skip execution of test that depends on a test that is larger than itself
11.5.4 - 2025-01-28
Changed
- #5958: Support for
#[CoversTrait]and#[UsesTrait]attributes is no longer deprecated - #5960: Support for targeting trait methods with the
#[CoversMethod]and#[UsesMethod]attributes is no longer deprecated
Fixed
- #6103: Output from test run in separate process is printed twice
- #6109: Skipping a test in a before-class method crashes JUnit XML logger
- #6111: Deprecations cause
SourceMapperto scan all<source/>files
11.5.3 - 2025-01-13
Added
Test\AfterLastTestMethodErrored,Test\AfterTestMethodErrored,Test\BeforeTestMethodErrored,Test\PostConditionErrored, andTest\PreConditionErroredevents
Fixed
- #6093: Test Double Code Generator does not work when PHPUnit is used from PHAR on PHP 8.4
- #6094: Errors in after-last-test methods are not reported
- #6095: Expectation is not counted correctly when a doubled method is called more often than is expected
- #6096:
--list-tests-xmlis broken when a group with a numeric name is defined - #6098: No
system-outelement in JUnit XML logfile - #6100: Suppressed deprecations incorrectly stop test execution when execution should be stopped on deprecation
11.5.2 - 2024-12-21
Fixed
- #6082:
assertArrayHasKey(),assertArrayNotHasKey(),arrayHasKey(), andArrayHasKey::__construct()do not support all possible key types - #6087:
--migrate-configurationdoes not removebeStrictAboutTodoAnnotatedTestsattribute from XML configuration file
11.5.1 - 2024-12-11
Added
- #6081:
DefaultResultCache::mergeWith()for merging result cache instances
Fixed
- #6066: TeamCity logger does not handle error/skipped events in before-class methods correctly
11.5.0 - 2024-12-06
Added
- #5948: Support for Property Hooks in Test Doubles
- #5954: Provide a way to stop execution at a particular deprecation
- Method
assertContainsNotOnlyInstancesOf()in thePHPUnit\Framework\Assertclass as the inverse of theassertContainsOnlyInstancesOf()method - Methods
assertContainsOnlyArray(),assertContainsOnlyBool(),assertContainsOnlyCallable(),assertContainsOnlyFloat(),assertContainsOnlyInt(),assertContainsOnlyIterable(),assertContainsOnlyNull(),assertContainsOnlyNumeric(),assertContainsOnlyObject(),assertContainsOnlyResource(),assertContainsOnlyClosedResource(),assertContainsOnlyScalar(), andassertContainsOnlyString()in thePHPUnit\Framework\Assertclass as specialized alternatives for the genericassertContainsOnly()method - Methods
assertContainsNotOnlyArray(),assertContainsNotOnlyBool(),assertContainsNotOnlyCallable(),assertContainsNotOnlyFloat(),assertContainsNotOnlyInt(),assertContainsNotOnlyIterable(),assertContainsNotOnlyNull(),assertContainsNotOnlyNumeric(),assertContainsNotOnlyObject(),assertContainsNotOnlyResource(),assertContainsNotOnlyClosedResource(),assertContainsNotOnlyScalar(), andassertContainsNotOnlyString()in thePHPUnit\Framework\Assertclass as specialized alternatives for the genericassertNotContainsOnly()method - Methods
containsOnlyArray(),containsOnlyBool(),containsOnlyCallable(),containsOnlyFloat(),containsOnlyInt(),containsOnlyIterable(),containsOnlyNull(),containsOnlyNumeric(),containsOnlyObject(),containsOnlyResource(),containsOnlyClosedResource(),containsOnlyScalar(), andcontainsOnlyString()in thePHPUnit\Framework\Assertclass as specialized alternatives for the genericcontainsOnly()method - Methods
isArray(),isBool(),isCallable(),isFloat(),isInt(),isIterable(),isNumeric(),isObject(),isResource(),isClosedResource(),isScalar(),isString()in thePHPUnit\Framework\Assertclass as specialized alternatives for the genericisType()method TestRunner\ChildProcessStartedandTestRunner\ChildProcessFinishedevents
Changed
- #5998: Do not run
SKIPIFsection of PHPT test in separate process when it is free of side effects - #5999: Do not run
CLEANsection of PHPT test in separate process when it is free of side effects that modify the parent process
Deprecated
- #6052:
isType()(useisArray(),isBool(),isCallable(),isFloat(),isInt(),isIterable(),isNull(),isNumeric(),isObject(),isResource(),isClosedResource(),isScalar(), orisString()instead) - #6055:
assertContainsOnly()(useassertContainsOnlyArray(),assertContainsOnlyBool(),assertContainsOnlyCallable(),assertContainsOnlyFloat(),assertContainsOnlyInt(),assertContainsOnlyIterable(),assertContainsOnlyNumeric(),assertContainsOnlyObject(),assertContainsOnlyResource(),assertContainsOnlyClosedResource(),assertContainsOnlyScalar(), orassertContainsOnlyString()instead) - #6055:
assertNotContainsOnly()(useassertContainsNotOnlyArray(),assertContainsNotOnlyBool(),assertContainsNotOnlyCallable(),assertContainsNotOnlyFloat(),assertContainsNotOnlyInt(),assertContainsNotOnlyIterable(),assertContainsNotOnlyNumeric(),assertContainsNotOnlyObject(),assertContainsNotOnlyResource(),assertContainsNotOnlyClosedResource(),assertContainsNotOnlyScalar(), orassertContainsNotOnlyString()instead) - #6059:
containsOnly()(usecontainsOnlyArray(),containsOnlyBool(),containsOnlyCallable(),containsOnlyFloat(),containsOnlyInt(),containsOnlyIterable(),containsOnlyNumeric(),containsOnlyObject(),containsOnlyResource(),containsOnlyClosedResource(),containsOnlyScalar(), orcontainsOnlyString()instead)