mathisburger/phpunit-stopwatch

There is no license information available for the latest version (v1.0.0) of this package.

A php library for phpunit to test the performance of php applications

v1.0.0 2022-10-22 16:11 UTC

This package is auto-updated.

Last update: 2024-10-22 20:32:39 UTC


README

phpunit-stopwatch

A php library that provides some traits and testcases for phpunit for performance and memory tests

Project information

Phpunit stopwatch is a simple php library that uses phpunit and stopwatch to perform tests on the memory usage and execution time of some php functions. It provides a simple test case as well as a trait that can be implemented in custom test cases.

Installation

Just install it via composer:

composer require mathisburger/phpunit-stopwatch

Usage

class SomeTest extends \MathisBurger\PhpUnitStopwatch\StopwatchTestCase
{
    public function testSomething(): void
    {
        $this->runPerformanceTest(function () {
            sleep(2);
        });
        // Is successful
        $this->assertExecutionTimeBelow(3000);
    }
}

License

This project is MIT licensed