octopyid/phpunit-extra

Extra assertions for PHPUnit

v1.0.1 2023-02-16 14:22 UTC

This package is auto-updated.

Last update: 2024-05-16 16:51:37 UTC


README

Version Downloads License

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.