diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-04-29 11:04:08 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-04-29 16:31:19 +0300 |
commit | 63eb3694e4a2d87342f8b478bd02fff79a8c73e7 (patch) | |
tree | 927a85056427fa32254f37ee58ad709d93f1cf4d /apps/dav/tests/unit/CalDAV/CalDavBackendTest.php | |
parent | abb5b5d983be485b7e006085643788e5e007d942 (diff) |
Exclusively use the typed calendar deletion events for DAV
We had both in places, but the old one isn't used anywhere outside this
app, so it's time to migrate the code.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/tests/unit/CalDAV/CalDavBackendTest.php')
-rw-r--r-- | apps/dav/tests/unit/CalDAV/CalDavBackendTest.php | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 5016b708718..25966aa5c95 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -36,6 +36,7 @@ use DateTime; use DateTimeZone; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CalDAV\Calendar; +use OCA\DAV\Events\CalendarDeletedEvent; use OCP\IConfig; use OCP\IL10N; use Sabre\DAV\Exception\NotFound; @@ -72,12 +73,14 @@ class CalDavBackendTest extends AbstractCalDavBackend { $this->assertEquals('User\'s displayname', $calendars[0]['{http://nextcloud.com/ns}owner-displayname']); // delete the address book - $this->legacyDispatcher->expects($this->at(0)) - ->method('dispatch') - ->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar'); + $this->dispatcher->expects(self::once()) + ->method('dispatchTyped') + ->with(self::callback(function ($event) { + return $event instanceof CalendarDeletedEvent; + })); $this->backend->deleteCalendar($calendars[0]['id']); $calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER); - $this->assertCount(0, $calendars); + self::assertEmpty($calendars); } public function providesSharingData() { @@ -196,13 +199,15 @@ EOD; $this->assertAccess($userCanRead, self::UNIT_TEST_USER1, '{DAV:}read', $acl); $this->assertAccess($userCanWrite, self::UNIT_TEST_USER1, '{DAV:}write', $acl); - // delete the address book - $this->legacyDispatcher->expects($this->at(0)) - ->method('dispatch') - ->with('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar'); + // delete the calendar + $this->dispatcher->expects(self::once()) + ->method('dispatchTyped') + ->with(self::callback(function ($event) { + return $event instanceof CalendarDeletedEvent; + })); $this->backend->deleteCalendar($calendars[0]['id']); $calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER); - $this->assertCount(0, $calendars); + self::assertEmpty($calendars); } public function testCalendarObjectsOperations() { |