From 3479555516522e7cba8c984a3967f4c9cce927fd Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 9 Sep 2024 02:22:17 +0100 Subject: [PATCH] wip --- pest3-now-available.md | 70 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/pest3-now-available.md b/pest3-now-available.md index e5386a8..db00a85 100644 --- a/pest3-now-available.md +++ b/pest3-now-available.md @@ -74,16 +74,82 @@ As you may know, [Architecture testing](#arch-testing) enables you to specify ex It's one of the most popular features of Pest, and with Pest 3, we're introducing **Arch Presets**. Arch Presets are a set of predefined architectural rules that you can use to test your application's architecture. These presets are designed to help you get started with architecture testing quickly and easily. +div class="collection-method-list" markdown="1"> + +- [`php`](#preset-php) +- [`security`](#preset-security) +- [`laravel`](#preset-laravel) +- [`strict`](#preset-strict) +- [`strict`](#preset-strict) +- [`custom`](#preset-custom) + + + + +### `php` + +The `php` preset is a predefined set of expectations that can be used on any php project. It's not coupled with any framework or library. + +It avoids the usage of `die`, `var_dump`, and similar functions, and ensures you are not using deprecated PHP functions. + ```php arch()->preset()->php(); +``` + +You may find all the expectations included in the `php` preset below in our [source code](https://github.com/pestphp/pest/blob/3.x/src/ArchPresets/Php.php). + +### `security` + +The `security` preset is a predefined set of expectations that can be used on any php project. It's not coupled with any framework or library. + +It ensures you are not using code that could lead to security vulnerabilities, such as `eval`, `md5`, and similar functions. + +```php arch()->preset()->security(); +``` + +You may find all the expectations included in the `security` preset below in our [source code](https://github.com/pestphp/pest/blob/3.x/src/ArchPresets/Security.php). + + +### `laravel` + +The `laravel` preset is a predefined set of expectations that can be used on [Laravel](https://laravel.com) projects. +It ensures you project's structure is following the well-known Laravel conventions, such as controllers only have `index`, `show`, `create`, `store`, `edit`, `update`, `destroy` as public methods and are always suffixed with `Controller` and so on. + +```php arch()->preset()->laravel(); +``` + +You may find all the expectations included in the `laravel` preset below in our [source code](https://github.com/pestphp/pest/blob/3.x/src/ArchPresets/Laravel.php). + + +### `strict` -arch()->preset()->strict(); // or ->relaxed() +The `strict` preset is a predefined set of expectations that can be used on any php project. It's not coupled with any framework or library. + +It ensures you are using strict types in all your files, that all your classes are final, and more. + +```php +arch()->preset()->strict(); ``` +You may find all the expectations included in the `strict` preset below in our [source code](https://github.com/pestphp/pest/blob/3.x/src/ArchPresets/Strict.php). + + +### `relaxed` + +The `relaxed` preset is a predefined set of expectations that can be used on any php project. It's not coupled with any framework or library. + +It is the opposite of the `strict` preset, ensuring you are not using strict types in all your files, that all your classes are not final, and more. + +```php +arch()->preset()->relaxed(); +``` + +You may find all the expectations included in the `relaxed` preset below in our [source code](https://github.com/pestphp/pest/blob/3.x/src/ArchPresets/Relaxed.php). + Just like regular architecture tests, you may ignore specific expectation targets using the `ignoring()` method. ```php @@ -92,6 +158,8 @@ arch()->preset()->security()->ignoring('md5'); arch()->preset()->laravel()->ignoring(User::class); ``` +To get started with Arch Presets, please refer to our [Architecture Testing](/docs/arch-testing#arch-presets) section. + ## Team Management