Skip to content

Error en la prueba guests_cannot_update_posts #3

@miguelcabgil

Description

@miguelcabgil

Tests\Feature\UpdatePostTest::guests_cannot_update_posts
Expected status code 403 but received 302.
Failed asserting that false is true.

/var/www/html/ValetProjects/styde-gates-mine/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:133
/var/www/html/ValetProjects/styde-gates-mine/tests/Feature/UpdatePostTest.php:73

Versión de laravel: 5.7.*

Código de la prueba guests_cannot_update_posts:

/** @test */
function guests_cannot_update_posts()
{
$this->withoutExceptionHandling();
$post = factory(Post::class)->create();

    $response = $this->put("admin/posts/{$post->id}", [
        'title' => 'Updated post title',
    ]);

    $response->assertRedirect('login');

    $this->assertDatabaseMissing('posts', [
        'id' => $post->id,
        'title' => 'Updated post title',
    ]);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions