aboutsummaryrefslogtreecommitdiff
path: root/tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php
blob: 70bb6d9a6dd5733c70eb730f6624b467436cdbf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
use JsonApi\Routes\Consultations\SlotsByBlockIndex;

require_once __DIR__ . '/ConsultationHelper.php';

class ConsultationsSlotsByBlockIndexTest extends Codeception\Test\Unit
{
    use ConsultationHelper;

    public function testFetchSlots(): void
    {
        $credentials = $this->tester->getCredentialsForTestDozent();
        $range = User::find($credentials['id']);

        $block = $this->createBlockWithSlotsForRange($range);

        $response = $this->sendMockRequest(
            '/consultation-blocks/{id}/slots',
            SlotsByBlockIndex::class,
            $credentials,
            ['id' => $block->id]
        );
        $document = $this->getResourceCollectionDocument($response);

        $resources = $document->primaryResources();
        $this->tester->assertCount(8, $resources);
    }
}