Category: Laravel

If you're using Codeception as a testing framework for your Laravel app, you may find yourself wanting to use some of the familiar Laravel testing assertions that you can find in Illuminate\Testing\TestResponse. I assume you're already using both Laravel and Codeception, so I won't go down the road of helping you set those up.

First let's head over to routes/api.php and add the following: If we were to use Laravel's built in test suite, we'd probably write the following feature test: How can we replicate this in Codeception?

We'll use this getLaravelResponse method in our Codeception tests to gain access to a number of familiar Laravel assertions such as assertSuccessful or assertJson.

Our Codeception test now looks and feels similar to our Laravel test.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners