Download the PHP package twada/phpunit-size-distribution without Composer
On this page you can find all versions of the php package twada/phpunit-size-distribution. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download twada/phpunit-size-distribution
More information about twada/phpunit-size-distribution
Files in twada/phpunit-size-distribution
Package phpunit-size-distribution
Short Description A PHPUnit extension that measures and reports test size distribution (Small/Medium/Large)
License MIT
Homepage https://github.com/twada/phpunit-size-distribution
Informations about the package phpunit-size-distribution
phpunit-size-distribution
A PHPUnit extension that measures and reports test size distribution (Small/Medium/Large).
Overview
PHPUnit supports test size classification through #[Small], #[Medium], and #[Large] attributes. This extension analyzes your test suite and reports the distribution of test sizes, helping you maintain a healthy test pyramid.
Requirements
- PHP 8.1+
- PHPUnit 10.5+ / 11.x / 12.x
Installation
Configuration
Register the extension in your phpunit.xml:
Usage
Run your tests as usual:
After test execution, you'll see a report like this:
Test Size Categories
| Category | Description |
|---|---|
| Small | Tests marked with #[Small] attribute |
| Medium | Tests marked with #[Medium] attribute |
| Large | Tests marked with #[Large] attribute |
| None | Tests without any size attribute |
Example
Counting Rules
- Counted: Passed, Failed, and Errored tests
- Not counted: Skipped and Incomplete tests
Limitations
-
Class-level attributes only: PHPUnit's size attributes (
#[Small],#[Medium],#[Large]) can only be applied at the class level, not on individual test methods. All test methods in a class inherit the class's size. -
DataProvider inheritance: Test cases generated by DataProviders inherit the size attribute from their test class.
- No runtime detection: This extension reads PHPUnit's metadata attributes. It does not measure actual execution time or resource usage.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
MIT License. See LICENSE for details.
Author
Takuto Wada