request = $this->createMock(IRequest::class);
$this->service = $this->createMock(UpcomingEventsService::class);
}
public function testGetEventsAnonymously(): void {
$controller = new UpcomingEventsController(
$this->request,
null,
$this->service,
);
$response = $controller->getEvents('https://cloud.example.com/call/123');
self::assertNull($response->getData());
self::assertSame(401, $response->getStatus());
}
public function testGetEventsByLocation(): void {
$controller = new UpcomingEventsController(
$this->request,
'u1',
$this->service,
);
$this->service->expects(self::once())
->method('getEvents')
->with('u1', 'https://cloud.example.com/call/123')
->willReturn([
new UpcomingEvent(
'abc-123',
null,
'personal',
123,
'Test',
'https://cloud.example.com/call/123',
null,
),
]);
$response = $controller->getEvents('https://cloud.example.com/call/123');
self::assertNotNull($response->getData());
self::assertIsArray($response->getData());
self::assertCount(1, $response->getData()['events']);
self::assertSame(200, $response->getStatus());
$event1 = $response->getData()['events'][0];
self::assertEquals('abc-123', $event1['uri']);
}
}
-unshare'>Jerome-Herbinet-better-new-wording-better-than-delete-and-unshare
Nextcloud server, a safe home for all your data: https://github.com/nextcloud/server | www-data |
blob: 50107b3bf71b9708d2a60e0427e6329293408aa0 (
plain)