Changes in Nette Tester 1.5.0

9 years ago by Miloslav Hůla  

The Nette Tester 1.5.0 has been released last week. It's a small release and here I bring news.

Compatibility with PHP 7 has been improved. Tester works with PHP 7 well and now it supports Throwable interface. So all PHP 7 exceptions are printed and dumped correctly. No more problems are known, if you hit some, open an issue, please.

The test runner (vendor/bin/tester) now prints PHP startup errors. It may disclose a problem with PHP extensions loading.

The next new feature is an internal thing for now. The Job instance, which represents one PHP process, now captures stderr output. It's internal because you cannot use it for assertion yet. Stderr capturing has been discussed a long time ago. It's because this part of PHP (capturing more descriptors then one) is very buggy on Windows. With new PHP versions, it looks better and better.

And that's all. As I said, a small release. Some tiny bugs in CloverXMLGenerator, Assert::match() and DomQuery::css2xpath() have been fixed. You can check the whole changelog for more information.

I have one bonus for you which I want to write in a bit more detail. It's about using Tester in a noncommon way.

Tester is available as a single PHAR file. It can be used dually. The first one is a library code source. You require PHAR file. Let's write two simple test files quick-1.phpt:

require __DIR__ . '/tester.phar';

Tester\Assert::true(TRUE);

and quick-2.phpt:

require __DIR__ . '/tester.phar';

Tester\Assert::true(FALSE);

Of course, you can run them as ordinary PHP scripts,

php quick-1.phpt
php quick-2.phpt

But with the Tester PHAR duality, you can simultaneously use tester.phar as a test runner:

php tester.phar *.phpt

One file, two purposes. It brings new workflow possibilities for quick prototyping. You don't need a composer.json. You don't need an unpacked Tester code. Just download one file, include it and run…