usernam3 / phpunit_stopwatch_annotations
phpunit test case with support for execution time and memory usage assertion in annotations
Installs: 543
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/usernam3/phpunit_stopwatch_annotations
Requires
- phpunit/phpunit: 4.*
- symfony/stopwatch: 2.*
This package is not auto-updated.
Last update: 2025-10-26 00:19:34 UTC
README
PHPUnit stopwatch annotations is a PHPUnit test case with support for execution time and memory usage assertion in annotations. It uses symfony/Stopwatch component for tracking time and memory usage of tests.
Installation
Via Composer
composer require --dev "usernam3/phpunit_stopwatch_annotations:dev-master"
Usage
To add support of @executionTime and @memoryUsage annotations you need to extend your test case class from \StopwatchAnnotations\TestCase.
@executionTime value is measured in milliseconds @memoryUsage in bytes.
Example of test case:
class ExampleTest extends \StopwatchAnnotations\TestCase { /** * @test * @executionTime 1999 */ public function executionTimeFailed() { sleep(2); } /** * @test * @memoryUsage 2000000 */ public function memoryUsageFailed() { } }