lundi 9 octobre 2017

Laravel how to test edit functionality

I have the following code to try to test the update functionality of Laravel. I want to edit the project, and then post it and see if it changed. This is my code so far, however this gives me the error that it makes a duplicate again.

    /** @test */
public function an_authenticated_user_can_edit_a_project()
{
    $this->logIn();

    $this->project->name = 'edited';

    $response = $this->post('/projects', $this->project->toArray());

    $this->get($response->headers->get('Location'))
        ->assertSee((string)$this->project->name)
    ;
}

Aucun commentaire:

Enregistrer un commentaire