Skip to content

Commit 4d3d3d7

Browse files
committed
Add missing check from test
1 parent 15165b1 commit 4d3d3d7

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

tests/Functional/ApiControllerTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,19 @@ public function testShareUserCalendar(): void
399399
$this->assertArrayHasKey('status', $data);
400400
$this->assertEquals('success', $data['status']);
401401

402-
// Note: The sharee is not returned by the API endpoint even though the share was created
403-
// successfully and is visible in the database. This check only verifies the response is successful.
402+
// Check if share was applied
403+
$client->request('GET', '/api/v1/calendars/'.$username.'/shares/'.$calendarId, [], [], [
404+
'HTTP_ACCEPT' => 'application/json',
405+
'HTTP_X_DAVIS_API_TOKEN' => $_ENV['API_KEY'],
406+
]);
407+
$this->assertResponseIsSuccessful();
408+
$this->assertResponseHeaderSame('Content-Type', 'application/json');
409+
410+
$data = json_decode($client->getResponse()->getContent(), true);
411+
$this->assertEquals('success', $data['status']);
412+
$this->assertArrayHasKey('data', $data);
413+
$this->assertStringContainsString($shareeUsername, $data['data'][0]['username']);
414+
$this->assertFalse($data['data'][0]['write_access']);
404415
}
405416

406417
/*

0 commit comments

Comments
 (0)