test create plan returns 201

This commit is contained in:
Yisroel Baum 2026-04-24 11:00:23 +03:00
parent 6b310c8c9c
commit ef71708abe
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -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']);
}
}