diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2024-01-29 15:16:24 +0000 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2024-01-29 15:16:24 +0000 |
| commit | 7c1df847d94d3956bc763b94b73cebfe108dc9a1 (patch) | |
| tree | e18e003bff65c5bf0748c644d6cd3d235cb1feca /tests/jsonapi | |
| parent | da0110d5e85279123e8dde392cb4c926397238bf (diff) | |
StEP 01354, closes #1354
Closes #1354
Merge request studip/studip!2116
Diffstat (limited to 'tests/jsonapi')
| -rw-r--r-- | tests/jsonapi/UserEventsIcalTest.php | 22 | ||||
| -rw-r--r-- | tests/jsonapi/UserEventsIndexTest.php | 20 | ||||
| -rw-r--r-- | tests/jsonapi/_bootstrap.php | 1 |
3 files changed, 24 insertions, 19 deletions
diff --git a/tests/jsonapi/UserEventsIcalTest.php b/tests/jsonapi/UserEventsIcalTest.php index 81230d4..c679f49 100644 --- a/tests/jsonapi/UserEventsIcalTest.php +++ b/tests/jsonapi/UserEventsIcalTest.php @@ -23,16 +23,18 @@ class UserEventsIcalTest extends \Codeception\Test\Unit { $credentials = $this->tester->getCredentialsForTestAutor(); - $calendar = new \SingleCalendar($credentials['id']); - $event = $calendar->getNewEvent(); - $event->setTitle('blypyp'); - - $oldUser = $GLOBALS['user'] ?? null; - $GLOBALS['user'] = \User::find($credentials['id']); - - $calendar->storeEvent($event, [$credentials['id']]); - - $GLOBALS['user'] = $oldUser; + $event = new \CalendarDate(); + $event->setId($event->getNewId()); + $now = time(); + $event->begin = $now; + $event->end = $now + 3600; + $event->title = 'blypyp'; + $event->store(); + $calendar_date = new \CalendarDateAssignment(); + $calendar_date->setId([$credentials['id'], $event->getId()]); + $calendar_date->calendar_date = $event; + $calendar_date->suppress_mails = true; + $calendar_date->store(); $app = $this->tester->createApp($credentials, 'get', '/users/{id}/events.ics', UserEventsIcal::class); diff --git a/tests/jsonapi/UserEventsIndexTest.php b/tests/jsonapi/UserEventsIndexTest.php index 0941f09..ac07471 100644 --- a/tests/jsonapi/UserEventsIndexTest.php +++ b/tests/jsonapi/UserEventsIndexTest.php @@ -55,14 +55,16 @@ class UserEventsIndexTest extends \Codeception\Test\Unit private function createEvent($credentials) { - $calendar = new \SingleCalendar($credentials['id']); - $event = $calendar->getNewEvent(); - - $oldUser = $GLOBALS['user']; - $GLOBALS['user'] = \User::find($credentials['id']); - - $calendar->storeEvent($event, [$credentials['id']]); - - $GLOBALS['user'] = $oldUser; + $event = new \CalendarDate(); + $event->setId($event->getNewId()); + $now = time(); + $event->begin = $now; + $event->end = $now + 3600; + $event->store(); + $calendar_date = new \CalendarDateAssignment(); + $calendar_date->setId([$credentials['id'], $event->getId()]); + $calendar_date->calendar_date = $event; + $calendar_date->suppress_mails = true; + $calendar_date->store(); } } diff --git a/tests/jsonapi/_bootstrap.php b/tests/jsonapi/_bootstrap.php index 61325ef..82ae54e 100644 --- a/tests/jsonapi/_bootstrap.php +++ b/tests/jsonapi/_bootstrap.php @@ -41,6 +41,7 @@ StudipAutoloader::register(); // General classes folders StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/models'); +StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/models/calendar'); StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/models/resources'); StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/classes'); StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/classes', 'Studip'); |
