test create plan returns 201
This commit is contained in:
parent
6b310c8c9c
commit
ef71708abe
1 changed files with 20 additions and 0 deletions
|
|
@ -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']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue