aboutsummaryrefslogtreecommitdiff
path: root/tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2022-06-17 07:39:22 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2022-06-17 07:39:22 +0000
commitbb62df65ac6aa71a757b58a01f9cb95a859a38f9 (patch)
treeb59576cb558380c7d09847862e796a2fde670fc2 /tests/jsonapi/ConsultationsSlotsByBlockIndexTest.php
parentad8f5f3b12e4f12bd77f6e2b0f0c3e36c47c5694 (diff)
implement tests for consultation jsonapi routes
Closes #1174 Merge request studip/studip!696
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);
+ }
+}