feedbackStatus = FeedbackStatus::factory()->create(); $this->feedback = Feedback::factory()->create(); $this->data = Feedback::factory()->make()->only([ 'contact', 'text', 'status_id', ]); $this->user = User::factory()->create([ 'name' => 'admin', 'email' => 'test@example.com', 'password' => 123456 ]); } public function testIndexFeedbacksPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('feedback.index')); $response->assertOk(); } public function testStoreFeedback(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->post(route('feedback.store'), $this->data); $response->assertJson(["result" => "success"]); $this->assertDatabaseHas('feedback', $this->data); } public function testEditFeedbackPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('feedback.edit', $this->feedback)); $response->assertOk(); } public function testUpdateFeedback(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->patch(route('feedback.update', $this->feedback), $this->data); $response->assertRedirect(route('feedback.index')); $this->assertDatabaseHas('feedback', $this->data); } }