I ran this code snippet.
/** @test */ public function unauthenticated_users_cannot_delete_articles() { $article = Article::factory()->create(); $this->delete($article->path()) ->assertRedirect(route('login')); $this->signIn(); $this->delete($article->path()) ->assertStatus(403); } And got this message: Response status code [419] is not a redirect status code. When I turned off the csrf middleware at the route, this test returned green.
Isn't csrf middleware disabled for all tests, then why this happened? (The Docs say so.)
By the way, my laravel version is 8.
https://stackoverflow.com/questions/67443987/laravel-verifycsrftoken-middleware May 08, 2021 at 12:06PM
没有评论:
发表评论