Skip to main content

Pest Architecture Testing

Premium
2 min read

While debugging your Laravel application, you often use functions like dd(), dump(), etc. Architecture testing in Pest may help you scan the code before pushing to the repository, to ensure these functions don't exist anymore.

This is just one use-case. The architecture plugin allows you to check, for example, that only Enum files are in the specified folders.

Let's take a look at a practical example.

First, let's create a test.

php artisan make:test ArchTest

Let's check for debugging calls.

tests/Feature/ArchTest.php:

arch('No debugging calls are used')
->expect(['dd', 'dump'])
->not->toBeUsed();

If any debugging calls are left, we will...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (30 h 41 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.