teamradhq / testing
A collection of assertions and helpers to use in testing.
Requires
- php: ^8.2
Requires (Dev)
- laravel/pint: ^1.29
- mockery/mockery: ^1.6
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-mockery: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^13.1
- rector/rector: ^2.4
- squizlabs/php_codesniffer: ^4.0
- symfony/var-dumper: ^8.0
README
This package contains a collection of assertions, reflection helpers and other utilities that I use frequently in PHPUnit tests.
composer require --dev teamradhq/testing
Utilities
Helpers
Inspector
A static helper with a that provides a number of methods to inspect and interact with objects using reflection.
Assertion Libraries
ArrayAssertions
Provides some assertions for arrays that can be used to assert partial or complete "sameness".
Tip
Here sameness means that arrays are equal in content regardless of the order of elements.
ObjectAssertions
Use the Inspector to provide a range of assertions for validating objects. It
Tip
Sometimes it just isn't possible to refactor a class to make it more testable using DI or similar techniques. This is where these assertions come in handy. These can either be permanent fixtures in your test library, or can be used to validate the existing behaviour before refactoring.