pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.06k stars 313 forks source link

[3.x] Arch Presets #1170

Closed nunomaduro closed 3 weeks ago

nunomaduro commented 3 weeks ago

This pull request is a work in progress, and presets are currently being defined...

This pull request introduces the concept of "Arch Presets" to Pest 3; witch a simple way of executing a "group" of arch tests predefined by the Pest team.

While the existing arch tests (https://pestphp.com/docs/arch-testing) are powerful, they still require you to granular define the rules you want to enforce. This is great for fine-grained control, but can be a bit verbose for simple use-cases.

// before:
arch('globals')
    ->expect(['dd', 'dump'])
    ->not->toBeUsed();

// + 100 rules written by you
// after:
arch()->preset()->base(); // == 100 rules...

arch()->preset()->laravel(); // == 120 rules...

arch()->preset()->security(); // == 50 rules