2 years ago

More verbose PHPUnit tests with Laravel

Posted 2 years ago by founders

I have this small test that checks that all Posts returns HTTP header 200:

 * Test that all active posts returns HTTP status 200
public function posts() {
    $posts = new Post;
    $posts = $posts->get();
    foreach ($posts as $post) {
        if ($post->active) {

However, when it fails it doesn't let me know in which slug. It just says that "posts() failed":

1) Tests\Feature\TestPosts::posts
Response status code [500] is not a successful status code.
Failed asserting that false is true.

Please sign in or create an account to participate in this conversation.