Comment exécuter la méthode delete en TDD, tests?

Dans laravel 5.8 app je fais TDD, tests pour l'administration des opérations CRUD pour la table , faire des post, put demandes, mais je n'ai pas réussi à faire supprimer :

    public function testVoteCategoriesCrud()
    {

        $this->withoutExceptionHandling();
        $this->withoutMiddleware();

        $newVoteCategoryRow         = factory('App\VoteCategory')->make(); // Create new VoteCategory Data Row
        $newVoteCategoryRow->name   .= ' created on ' . strftime("%%Y-%%m-%%d %%H:%%M:%%S:%%U") ;
        $new_vote_category_row_name = $newVoteCategoryRow->name;

        $response = $this->actingAs($loggedUser)->post('/admin/vote-categories', $newVoteCategoryRow->toArray());
        $this->assertCount( $original_vote_categories_count+1, VoteCategory::all() );    // to use HTTP_RESPONSE_OK
        $response->assertRedirect('/admin/vote-categories'); // after successful post request redirect to '/admin/vote-categories'

        ...
        $response = $this->actingAs($loggedUser)->delete( '/admin/vote-categories', ['id'=>$checkCreatedVoteCategory->id] );

        $this->assertCount( $original_vote_categories_count, VoteCategory::all() );    // to use HTTP_RESPONSE_OK
        $response->assertRedirect('/admin/vote-categories'); // after successful put request redirect to '/admin/vote-categories'

But I got error 
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: The DELETE method is not supported for this route. Supported methods: GET, HEAD, POST.

sur supprimer la méthode ci-dessus.

Comment supprimer correctement rangée dans les tests?

0
2019-09-17 09:27:36
source
0 réponses

Voir d'autres questions sur les étiquettes