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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<?php
use JsonApi\Routes\Consultations\SlotShow;
use JsonApi\Schemas\ConsultationSlot as Schema;
require_once __DIR__ . '/ConsultationHelper.php';
class ConsultationsSlotShowTest extends Codeception\Test\Unit
{
use ConsultationHelper;
public function testFetchBlock(): void
{
$credentials = $this->tester->getCredentialsForTestDozent();
$range = User::find($credentials['id']);
$block = $this->createBlockWithSlotsForRange($range);
$slot = $this->getSlotFromBlock($block);
$response = $this->sendMockRequest(
'/consultation-slots/{id}',
SlotShow::class,
$credentials,
['id' => $slot->id]
);
$document = $this->getSingleResourceDocument($response);
$resourceObject = $document->primaryResource();
$this->assertTrue(is_string($resourceObject->id()));
$this->assertSame($slot->id, $resourceObject->id());
$this->assertSame(Schema::TYPE, $resourceObject->type());
$this->assertEquals($slot->start_time, strtotime($resourceObject->attribute('start_time')));
$this->assertEquals($slot->end_time, strtotime($resourceObject->attribute('end_time')));
$this->assertHasRelations($resourceObject, Schema::REL_BLOCK, Schema::REL_BOOKINGS);
//
// $this->assertSame(self::$BLOCK_DATA['room'], $resourceObject->attribute('room'));
// $this->assertSame(self::$BLOCK_DATA['show_participants'], $resourceObject->attribute('show-participants'));
// $this->assertSame(self::$BLOCK_DATA['require_reason'], $resourceObject->attribute('require-reason'));
// $this->assertSame(self::$BLOCK_DATA['confirmation_text'], $resourceObject->attribute('confirmation-text'));
// $this->assertSame(self::$BLOCK_DATA['note'], $resourceObject->attribute('note'));
// $this->assertSame(self::$BLOCK_DATA['size'], $resourceObject->attribute('size'));
}
}
|