aboutsummaryrefslogtreecommitdiff
path: root/tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php')
-rw-r--r--tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php b/tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php
new file mode 100644
index 0000000..70bb6d9
--- /dev/null
+++ b/tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php
@@ -0,0 +1,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);
+ }
+}