Laravel 8.22 Release With new Event Fake Assertion Announced

Laravel 8.22 Release

Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced.

This new release also comes with several fixes and improvements.

Laravel 8.22 comes with a new assertion assertNothingDispatched() to Event::fake() mock. Currently, all the assertion for Events require a specific event to be provided, this will catch “any” event. See example:

Add reduce with keys to collections and lazy collections features adds the method reduceWithKeys to Collections and LazyCollections.

Similar to map and mapWithKeys, this augments reduce to pass associative arrays’ keys to its callback. We can’t do that currently because PHP‘s array_reduce doesn’t pass array keys to its callback. See example:

Fixes in this release include a fixed error from missing null check on PHP 8 in Illuminate\Validation\Concerns\ValidatesAttributes::validateJson(). A bug with RetryCommand can happen if retryUntil doesn’t return a DateTimeInterface object but rather an integer timestamp or null.

Issues in Illuminate\Testing\PendingCommand::expectsTable() have been fixed as is the same with morphTo() attempting to map an empty string morph type to an instance.

Read Also  WordPress Briefly Unavailable for Scheduled Maintenance. Check Back in a Minute

For these and more about Laravel 8.22 release please visit the changelog here.