From 06f5aaaa9637a292e8ccafd4e8c4d1dcec13db2a Mon Sep 17 00:00:00 2001 From: alex-chevski Date: Fri, 19 Jan 2024 00:21:50 +0300 Subject: [PATCH] added test for not author user --- tests/Feature/Plan/EditTest.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/Feature/Plan/EditTest.php b/tests/Feature/Plan/EditTest.php index a75bd88..d878c36 100644 --- a/tests/Feature/Plan/EditTest.php +++ b/tests/Feature/Plan/EditTest.php @@ -36,12 +36,23 @@ class EditTest extends TestCase { $plan = $this->plan; $plan->author()->attach($this->user->id); + $response = $this + ->actingAs($this->user) + ->get(route('plan.edit', $plan)); + $response->assertSuccessful(); + } + + public function test_show_form_edit_plan_fail_for_not_author(): void + { + $plan = $this->plan; + $user = User::factory()->create(); + $plan->author()->attach($user->id); $response = $this ->actingAs($this->user) ->get(route('plan.edit', $plan)); - $response->assertSuccessful(); + $response->assertForbidden(); } public function test_publish_new_plan_success(): void