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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners