octopyid / phpunit-extra
Extra assertions for PHPUnit
v1.0.1
2023-02-16 14:22 UTC
Requires
- php: ^8.1|^8.2
- orchestra/testbench: ^8.0
- phpunit/phpunit: ^10.0
README
PHP Unit Extra
Custom collection for PHPUnit assertions
Installation
To install the package, simply follow the steps below.
Install the package using Composer:
composer require octopyid/phpunit-extra --dev
Available Assertions
1. Octopy\PHPUnitExtra\AssertQueryCount
A custom assertion for phpunit that allows you to count the number of SQL queries used in a test. Can be used to enforce certain performance characteristics.
$this->assertNoQueriesExecuted(); // No queries should be executed $this->assertQueryCountMatches(1); // Exactly one query should be executed $this->assertQueryCountLessThan(2); // Query count should be less than 2 $this->assertQueryCountGreaterThan(1); // Query count should be greater than 1
License
This package is licensed under the MIT license.