Nette Tester 2.2.0 is out
I didn't write blog article about releasing the 2.1.0. The main purpose for that release was to drop support for PHP below 7.1. Nobody complained so it looks like as a good step.
New in Tester
The 2.1.0 version brought one small feature. The
parameter is repeatable, so you can mark separated directories for coverage
The 2.2.0 version brings few minor fixes and mainly two new features.
Tester\Expect object allows you to test “random” items
in more complex data structures. You can use them in
methods. For example, you test a method which creates a new user and returns its
attributes as an array:
use Tester\Expect; Assert::equal([ 'id' => 123, 'username' => 'milo', 'password' => Expect::match('%h%'), # random string, hash, but must match some pattern 'created_at' => Expect::type(DateTimeImmutable::class), # check type only, not exact value ], User::create(123, 'milo', 'RandomPaSsWoRd'));
Until now, you had to unset these “random” items before assertion or test
array items one by one. The usage of
Expect is clearer with less
effort to type.
You can read more about
Expect in documentation.
The second new feature is support for PCOV. I didn't find what that acronym (or is it a word?) means, but it is a PHP extension especially written to provide code coverage functionality. So it is fast. Now, Tester supports three code coverage engines and question arose about which one to choose when more available. I defined following priority:
- PCOV, because it is a specialized tool
- PHPDBG SAPI, because I suppose that the code coverage is the only reason to run it
Many thanks to all contributors!