Repository navigation
Releases
Releases · sebastianbergmann/phpunit
PHPUnit 13.5.1
Immutable
release. Only release title and notes can be modified.
Changed
- The
Test\BeforeFirstTestMethodCalled,Test\BeforeTestMethodCalled,Test\PreConditionCalled,Test\PostConditionCalled,Test\AfterTestMethodCalled, andTest\AfterLastTestMethodCalledevents are now emitted before the hook method is invoked, not after it has returned: events that are emitted while a hook method is running, for instance for an issue that it triggers, now follow the event for that hook method
Fixed
- Deprecations, notices, and warnings that are suppressed using the
@operator, or that are ignored by the baseline, are reported, and can make the test runner exit with a shell exit code that indicates failure, when they are triggered outside of tests, for instance when a test file is loaded - The test runner crashes (
An error occurred inside PHPUnit.) when the socket that is configured as the target of--log-json,--log-junit,--log-teamcity,--testdox-html, or--testdox-text(or of their counterparts in the XML configuration file) cannot be opened: a test runner warning is now triggered and the logfile is not written - When
--allis used and a default test suite is configured using thedefaultTestSuiteattribute in the XML configuration file, the bootstrap scripts that are configured for the other test suites are not loaded although the tests of these test suites are run - The schema for the XML configuration file (
phpunit.xsd) states0as the default value of thedefaultTimeLimitattribute although the default value is1 - The logfile in Open Test Reporting XML format does not finish the test suites that were running when a test run is stopped because it did not end after its time limit (
--timeout) was exceeded: these test suites are now reported as aborted, together with the reason why the test run was stopped - The message that a test run was interrupted by a signal, or that its time limit (
--timeout) was exceeded, is not separated from the output that follows it when no test was run --warm-coverage-cachealways caches the result of the static analysis that determines the executable lines of a file from its syntax, also when a test run with the same configuration determines them from the bytecode of the file: the first test run then performs and caches the static analysis again- The schema for the XML configuration file (
phpunit.xsd) statesvar(--bs-gray-200)andvar(--bs-gray-800)as the default values of thecolorBreadcrumbsandcolorBreadcrumbsDarkattributes although the default values are#eef1f5and#22272e - The
phaseof the observation in the result of the test run in JSON format is wrong or missing when the PHP process ends while a before-test method, a pre-condition method, a post-condition method, or an after-test method is running - The
phaseof the observation in the result of the test run in JSON format ispost-conditioninstead oftestwhen an expectation for the output of a test is not met and the test class has a post-condition method
Learn how to install or update PHPUnit 13.5 in the documentation.
Keep up to date with PHPUnit:
- You can follow @phpunit@phpc.social to stay up to date with PHPUnit's development.
- You can subscribe to the PHPUnit Updates newsletter to receive updates about and tips for PHPUnit.
PHPUnit 13.5.0
Immutable
release. Only release title and notes can be modified.
Added
- #7038:
--show-effective-configurationCLI option to show what a configuration will execute, without executing it - #7039:
TestCase::suspendOutputBuffering()andTestCase::resumeOutputBuffering()methods for capturing the output of a test method thatTestCase::invokeTestMethod()runs in a coroutine with its own output buffers - #7049:
--random-seed <N>CLI option - #7086:
--triggering-tests-limitCLI option andtriggeringTestsLimitXML attribute to group and limit the tests listed for each issue - #7146: Run receipt that records what was run and how the run ended in Open Test Reporting logfile and the compact output
- #7198: Result of the test run in JSON format (
--json,--log-json) - phpunit/php-code-coverage #1056: The code coverage report in XML format includes branch and path coverage
- phpunit/php-code-coverage 14.6: The code coverage report in HTML format shows, next to a line that is covered, how many tests cover it or, when the code coverage driver collects hit counts, how often the line was executed
- phpunit/php-code-coverage 14.6: The code coverage report in HTML format has navigation between the pieces of code that are not covered: the
nandpkeys, and two buttons, jump to the next and to the previous one --gaps-onlyCLI option andgapsOnlyattribute for the<jsonl>element of the XML configuration file to limit the code coverage report in JSONL format to what is not covered:coverage.jsonlthen has no record for a file that has nothing that is not covered, and no record for a method or function that is covered--details-limit <n>CLI option to limit each message, each stack trace, and the output of each test that the compact output (--compact) prints, and each message, diff, and stack trace of the result of the test run in JSON format that is the output of--json, to<n>charactersexitCode()andsignal()methods on theTestRunner\ChildProcessFinishedandTestRunner\ChildProcessErroredevents for the exit code of a child process and the signal that terminated itoutcome()method on theApplication\Finishedevent for how the test run ended, as the run receipt records it: its status, the numbers of tests by outcome, and the numbers of the issues triggered by tests and by the test runner
Changed
- #7049: Renamed
phpunit:randomOrderSeedtophpunit:randomSeedin Open Test Reporting XML logfiles - #7051: Seed random number generators using
--random-seed <N>, regardless of whether PHPUnit needs random number generation - phpunit/php-code-coverage #1407: The line of the right operand of a
&&(orand) that spans multiple lines is no longer reported as covered when it was not executed, as this operand is not evaluated when the left operand is false - phpunit/php-code-coverage 14.6: The line of the right operand of a
||(oror) that spans multiple lines, and the lines of a method call or property fetch after?->that starts on a line of its own, are no longer reported as covered when they were not executed - phpunit/php-code-coverage 14.6: On PHP 8.6 and later, the executable lines of a file are determined from its bytecode instead of from its syntax when OPcache is enabled, compiles the code without optimizations (
opcache.optimization_level=0), and does not skip recently modified files (opcache.file_update_protection=0): lines that PHP attributes no code to, such as the continuation lines of a multi-line function call, are then no longer counted as executable - phpunit/php-code-coverage 14.6: Processing the code coverage data of a test, and merging the code coverage data of tests that are run in separate processes, is faster
- phpunit/php-code-coverage 14.6: The code coverage report in HTML format lists a directory that contains nothing but another directory, or nothing but a single file, together with what it contains instead of requiring a click for each level
- phpunit/php-code-coverage 14.6: The view for branch coverage of the code coverage report in HTML format shows, next to a line that a branch with more than one successor ends on, which of the edges out of that branch were taken
- The lines below the header of a record of the compact output (
--compact) are now indented by two spaces: a message, a diff, a stack trace, and the output of a test can no longer be mistaken for the header of a record, the summary line, or the receipt of the test run, which begin in the first column - The compact output (
--compact) now prints the path of a file inside the working directory relative to the working directory, which the receipt of the test run names, in the frames of a stack trace, in the header of the record for an issue, and in the location of a test that triggered an issue: the path to the project is no longer repeated in each of them, and a file outside the working directory stands out - The summary line of the compact output (
--compact) no longer begins withOKwhen no test failed or errored but the test run was cut short: it begins withSTOPPEDwhen a--stop-on-*option ended the test run, withINTERRUPTEDwhen a signal did, and withTIME LIMIT EXCEEDEDwhen the time limit configured using--timeoutwas exceeded - The compact output (
--compact) now prints that the test run was interrupted by a signal as a record of its own, after the summary line - The summary of the default output no longer says
OKwhen no test failed or errored but the test run was cut short: it saysSTOPPED!when a--stop-on-*option ended the test run,INTERRUPTED!when a signal did, andTIME LIMIT EXCEEDED!when the time limit configured using--timeoutwas exceeded, followed by the numbers of tests and assertions - The default output now says which
--stop-on-*option stopped the test run, in a line of its own before the result is printed, for instanceThe test run was stopped by --stop-on-failure.: a test run that was stopped after a test failed or errored was reported exactly like a test run that ran every selected test - A test run for which a time limit is configured using
--timeoutis no longer started when the time limit cannot be enforced because the pcntl extension is not available: the test runner then exits with an error message and shell exit code2, instead of only checking the time limit between two tests - A test run is no longer started when the cache directory that is configured using
--cache-directoryor thecacheDirectoryattribute cannot be created or cannot be written to: the test runner then exits with an error message that names the directory and with shell exit code2, before the bootstrap script, the extensions, or the tests are loaded. This does not depend on whether the test run would write to the cache directory, and it also applies to--warm-coverage-cache. Until now, such a test run recorded its history elsewhere, or not at all, without saying so, or crashed when code coverage was collected - A cache directory configured using
--cache-directorythat cannot be created is no longer replaced, without saying so, by the cache directory that is configured in the XML configuration file - A PHP process that ends before the test run did and while no test is running, for instance because a bootstrap script, an extension, a data provider, or a before-first-test method calls
exit(), or because PHP raises an error that ends the process while a code coverage report is written, is now reported as a premature end, as it already is when a test is running: a message such asFatal error: Premature end of PHP process while the bootstrap script was loaded.is printed and the shell exit code is2, also whenexit(0)was called - The compact output (
--compact) and the result of the test run in JSON format (--json,--log-json) now record a test run that did not reach its end because the PHP process ended while a bootstrap script, an extension, or the test suite was loaded, while tests were executed, or while the result of the test run was reported: the receipt and the JSON document are written with the statusended-prematurely - The Open Test Reporting XML logfile (
--log-otr) of a test run that did not reach its end, because the PHP process ended although the test runner did not end it, because the test runner crashed, or because a second interrupt signal (SIGINT) ended the test run at once, is now a complete document: the test and the test suites that were not finished are reported as aborted, and thephpunit:outcomeelement is written with the statusended-prematurely,crashed, orinterruptedand says why the test run did not reach its end in itsphpunit:reasonelement - The compact output (
--compact) and the result of the test run in JSON f...
PHPUnit 12.5.47
Immutable
release. Only release title and notes can be modified.
Fixed
- The test runner crashes (
An error occurred inside PHPUnit.) when the socket that is configured as the target of--log-junit,--log-teamcity,--testdox-html, or--testdox-text(or of their counterparts in the XML configuration file) cannot be opened: a test runner warning is now triggered and the logfile is not written - A deprecation that is suppressed using the
@operator is reported, and can make the test runner exit with a shell exit code that indicates failure, when it is triggered before the tests are run, for instance when a test file is loaded or by a data provider - When
--allis used and a default test suite is configured using thedefaultTestSuiteattribute in the XML configuration file, the bootstrap scripts that are configured for the other test suites are not loaded although the tests of these test suites are run - The schema for the XML configuration file (
phpunit.xsd) states0as the default value of thedefaultTimeLimitattribute although the default value is1
Learn how to install or update PHPUnit 12.5 in the documentation.
Keep up to date with PHPUnit:
- You can follow @phpunit@phpc.social to stay up to date with PHPUnit's development.
- You can subscribe to the PHPUnit Updates newsletter to receive updates about and tips for PHPUnit.
PHPUnit 12.5.46
Immutable
release. Only release title and notes can be modified.
Fixed
assertFinite()does not tell PHPStan that the value is a finitefloator anint, so the type of the value is not narrowed when test code is analysed with PHPStan (this requires PHPStan 2.3.6 or newer)- The process that runs a PHPT test with an
--ENV--section is started with an environment that is built from$_SERVERinstead of the environment of the test runner's process: environment variables that were set usingputenv(), for instance those configured using<env>in the XML configuration file, are missing, and elements of$_SERVERthat are not environment variables, for instance those configured using<server>in the XML configuration file, are exported as environment variables
Learn how to install or update PHPUnit 12.5 in the documentation.
Keep up to date with PHPUnit:
- You can follow @phpunit@phpc.social to stay up to date with PHPUnit's development.
- You can subscribe to the PHPUnit Updates newsletter to receive updates about and tips for PHPUnit.