Skip to content

Releases

PHPUnit 13.5.1

Choose a tag to compare

@github-actions github-actions released this 04 Dec 09:38
Immutable release. Only release title and notes can be modified.
13.5.1
ede8276

Changed

  • The Test\BeforeFirstTestMethodCalled, Test\BeforeTestMethodCalled, Test\PreConditionCalled, Test\PostConditionCalled, Test\AfterTestMethodCalled, and Test\AfterLastTestMethodCalled events 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 --all is used and a default test suite is configured using the defaultTestSuite attribute 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) states 0 as the default value of the defaultTimeLimit attribute although the default value is 1
  • 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-cache always 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) states var(--bs-gray-200) and var(--bs-gray-800) as the default values of the colorBreadcrumbs and colorBreadcrumbsDark attributes although the default values are #eef1f5 and #22272e
  • The phase of 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 phase of the observation in the result of the test run in JSON format is post-condition instead of test when 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

Choose a tag to compare

@github-actions github-actions released this 04 Dec 04:28
Immutable release. Only release title and notes can be modified.
13.5.0
cb9a141

Added

  • #7038: --show-effective-configuration CLI option to show what a configuration will execute, without executing it
  • #7039: TestCase::suspendOutputBuffering() and TestCase::resumeOutputBuffering() methods for capturing the output of a test method that TestCase::invokeTestMethod() runs in a coroutine with its own output buffers
  • #7049: --random-seed <N> CLI option
  • #7086: --triggering-tests-limit CLI option and triggeringTestsLimit XML 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 n and p keys, and two buttons, jump to the next and to the previous one
  • --gaps-only CLI option and gapsOnly attribute for the <jsonl> element of the XML configuration file to limit the code coverage report in JSONL format to what is not covered: coverage.jsonl then 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> characters
  • exitCode() and signal() methods on the TestRunner\ChildProcessFinished and TestRunner\ChildProcessErrored events for the exit code of a child process and the signal that terminated it
  • outcome() method on the Application\Finished event 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:randomOrderSeed to phpunit:randomSeed in 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 && (or and) 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 || (or or) 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 with OK when no test failed or errored but the test run was cut short: it begins with STOPPED when a --stop-on-* option ended the test run, with INTERRUPTED when a signal did, and with TIME LIMIT EXCEEDED when the time limit configured using --timeout was 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 OK when no test failed or errored but the test run was cut short: it says STOPPED! when a --stop-on-* option ended the test run, INTERRUPTED! when a signal did, and TIME LIMIT EXCEEDED! when the time limit configured using --timeout was 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 instance The 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 --timeout is 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 code 2, 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-directory or the cacheDirectory attribute 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 code 2, 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-directory that 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 as Fatal error: Premature end of PHP process while the bootstrap script was loaded. is printed and the shell exit code is 2, also when exit(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 status ended-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 the phpunit:outcome element is written with the status ended-prematurely, crashed, or interrupted and says why the test run did not reach its end in its phpunit:reason element
  • The compact output (--compact) and the result of the test run in JSON f...
Read more

PHPUnit 12.5.47

Choose a tag to compare

@github-actions github-actions released this 04 Dec 09:22
Immutable release. Only release title and notes can be modified.
12.5.47
d3418c2

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 --all is used and a default test suite is configured using the defaultTestSuite attribute 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) states 0 as the default value of the defaultTimeLimit attribute although the default value is 1

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

Choose a tag to compare

@github-actions github-actions released this 04 Dec 04:01
Immutable release. Only release title and notes can be modified.
12.5.46
26b8cd7

Fixed

  • assertFinite() does not tell PHPStan that the value is a finite float or an int, 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 $_SERVER instead of the environment of the test runner's process: environment variables that were set using putenv(), for instance those configured using <env> in the XML configuration file, are missing, and elements of $_SERVER that 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.

PHPUnit 13.4.8

Choose a tag to compare