Nette Tester 2.4.0 is out

about a month ago by Miloslav Hůla     edit

New minor release is out. And since there were no blog posts about patch versions from 2.3.1 to 2.3.5, I'll cover them in this post too. Let's go from the past to the present.

Patch Releases

Version 2.3.1 is purely maintenance one, just like version 2.3.2 but this one brought two small improvements.

The first one is that Tester\Runner has a new public string[] $ignoreDirs property. It contains directories that are ignored when runner searches for test files. Default one is vendor.

The second one is that Tester\DomQuery does not emit warning on parsing “unknown” HTML tag because it is quite hard to say what is “unknown”. With this change, HTML can contain SVG or MathML markups, or any custom element at all.

Tester internally started to use GitHub Actions workflow and PHPStan.

Version 2.3.3 brought more small improvements.

If Dumper's output contains some paths, these are now clickable in PhpStorm terminal with Awesome Console plugin.

Waiting for the last runner's job has been fixed. Bug used to cause a high CPU usage.

The assertion exception message contains @dataProvider data set name (array key). With a higher amount of data sets it was quite hard to find out the failing one. Now you get hint, for example: true should be false in testMe() (data set '231').

PHAR distribution of Tester has been dropped. I found out that tester.phar didn't work really long time and no one complained. The dead code was buried.

Version 2.3.4 is another maintenance one. It was released at the time of PHP 8.0 RC was born and contains commits for incoming PHP 8 compatibility.

Version 2.3.5 is a bugfix and compatibility improvement release. Mainly it supports Xdebug 3. And one nasty bug in @dataProvider handling has been fixed. If you are using integer indexed data sets, it may happend that only first data set record has been tested. So please, upgrade to v2.3.5 at least.

Release 2.4.0

And finally, version 2.4.0 is a fresh new minor release.

Code coverage report got some improvements thanks to Matouš Němec (mesour). Loading in the browser is about one order of magnitude faster and the size of the generated file is about 20% smaller. Tests file list can be ordered by coverage percent or by name and organized as a tree. A report title contains information about count of files and lines of code. See example. Thank you Matouš!

Tester\Assert has new methods hasKey() and hasNotKey() which test presence of key in array.

Tester\Runner\Test has new method getDuration(): ?float which returns runtime duration in seconds. A null means that test did not run, for example, has been skipped during initialization process. You can use duration information in your own output handlers.

Command line option -o is repeatable and accepts file name parameter. If file name is ommitted, stdout is used. Best by example:

tester -o console -o log:report.log -o junit:report.xml

Option --log is replaced by -o log but still works to keep compatibility.

Test handler now uses cache for test case methods list. What does it mean? If you write tests as TestCase, runner has to examine list of test methods by every run. With a larger number of TestCases, let's say 100, it may took 2 seconds or more because of every new PHP process. This lag is skipped now. Test handler monitors modification time of files with a test case class, its parent and all of its traits. As a storage it uses temporary directory adjustable via --temp option. Please, send me a feedback on this feature.

Tester\TestCase has new method skip(string $message). With it, you can skip a single test method and not a whole test file.

And one small BC break. Method DataProvider::load() may return empty data set now. It used to throw an exception is such case, so your existing tests should not be affected.

And that's all. See you next time.

Further reading