From 68554cb362775e6991b454b2c8af8a8ebdcb03de Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Fri, 24 Apr 2026 11:01:47 +0300 Subject: [PATCH] test create plan 400 when date end before start --- tests/e2e/Controllers/PlanControllerTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/e2e/Controllers/PlanControllerTest.php b/tests/e2e/Controllers/PlanControllerTest.php index 6ade21a..5d99621 100644 --- a/tests/e2e/Controllers/PlanControllerTest.php +++ b/tests/e2e/Controllers/PlanControllerTest.php @@ -180,4 +180,23 @@ class PlanControllerTest extends TestCase $body = json_decode($response->getBody(), true); $this->assertArrayHasKey('error', $body); } + + public function test_create_plan_returns_400_when_date_end_before_start(): void + { + $response = $this->controller->createPlan( + $this->makeRequest([ + 'userId' => 0, + 'textId' => 0, + 'name' => 'My Plan', + 'dateStart' => '2025-01-02', + 'dateEnd' => '2025-01-01', + ]), + new Response(), + $this->createPlan, + ); + + $this->assertEquals(400, $response->getStatusCode()); + $body = json_decode($response->getBody(), true); + $this->assertArrayHasKey('error', $body); + } }