From ef71708abe4d39e84f8c3935fd10d843b9b74b7b Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Fri, 24 Apr 2026 11:00:23 +0300 Subject: [PATCH] test create plan returns 201 --- tests/e2e/Controllers/PlanControllerTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/e2e/Controllers/PlanControllerTest.php b/tests/e2e/Controllers/PlanControllerTest.php index 50ddfe1..e5390b8 100644 --- a/tests/e2e/Controllers/PlanControllerTest.php +++ b/tests/e2e/Controllers/PlanControllerTest.php @@ -70,4 +70,24 @@ class PlanControllerTest extends TestCase ->withHeader('Content-Type', 'application/json') ->withBody($body); } + + public function test_create_plan_returns_201_with_id_and_name(): void + { + $response = $this->controller->createPlan( + $this->makeRequest([ + 'userId' => 0, + 'textId' => 0, + 'name' => 'My Plan', + 'dateStart' => '2025-01-01', + 'dateEnd' => '2025-01-01', + ]), + new Response(), + $this->createPlan, + ); + + $this->assertEquals(201, $response->getStatusCode()); + $body = json_decode($response->getBody(), true); + $this->assertArrayHasKey('id', $body); + $this->assertEquals('My Plan', $body['name']); + } }