From ecb43fda2d4acea50843a9f34772221412c11323 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Fri, 24 Apr 2026 11:00:37 +0300 Subject: [PATCH] test create plan 400 when user id missing --- tests/e2e/Controllers/PlanControllerTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/e2e/Controllers/PlanControllerTest.php b/tests/e2e/Controllers/PlanControllerTest.php index e5390b8..54f541e 100644 --- a/tests/e2e/Controllers/PlanControllerTest.php +++ b/tests/e2e/Controllers/PlanControllerTest.php @@ -90,4 +90,22 @@ class PlanControllerTest extends TestCase $this->assertArrayHasKey('id', $body); $this->assertEquals('My Plan', $body['name']); } + + public function test_create_plan_returns_400_when_user_id_missing(): void + { + $response = $this->controller->createPlan( + $this->makeRequest([ + 'textId' => 0, + 'name' => 'My Plan', + 'dateStart' => '2025-01-01', + 'dateEnd' => '2025-01-01', + ]), + new Response(), + $this->createPlan, + ); + + $this->assertEquals(400, $response->getStatusCode()); + $body = json_decode($response->getBody(), true); + $this->assertArrayHasKey('error', $body); + } }