diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2023-03-02 11:54:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-02 11:54:51 +0100 |
commit | e08fa782249c201baf042c8cdf2362fc2300f85f (patch) | |
tree | e73deed0d20eed7e05beae4fe8f6b65c1a0d118e /apps/dav/tests | |
parent | 2f64d16afdaeccee608c861a3729c817d7a8e7bb (diff) | |
parent | 4fd58aa45cdd4a15be0f3eafcd353715c37d4d63 (diff) | |
download | nextcloud-server-e08fa782249c201baf042c8cdf2362fc2300f85f.tar.gz nextcloud-server-e08fa782249c201baf042c8cdf2362fc2300f85f.zip |
Merge pull request #36594 from nextcloud/fix-handling-of-invitations
fix(caldav): Correctly handle calendar recreation for invitations when the current calendar is in the trashbin
Diffstat (limited to 'apps/dav/tests')
-rw-r--r-- | apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index 4845188bc88..8f315eac0ee 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -197,6 +197,16 @@ class PluginTest extends TestCase { false, CalDavBackend::PERSONAL_CALENDAR_URI, CalDavBackend::PERSONAL_CALENDAR_NAME, + true, + true + ], + [ + 'principals/users/myuser', + 'calendars/myuser', + false, + CalDavBackend::PERSONAL_CALENDAR_URI, + CalDavBackend::PERSONAL_CALENDAR_NAME, + false, false, true ], @@ -225,6 +235,7 @@ class PluginTest extends TestCase { true, false, false, + false, ], [ 'principals/users/myuser', @@ -263,16 +274,8 @@ class PluginTest extends TestCase { /** * @dataProvider propFindDefaultCalendarUrlProvider - * @param string $principalUri - * @param string|null $calendarHome - * @param bool $isResource - * @param string $calendarUri - * @param string $displayName - * @param bool $exists - * @param bool $propertiesForPath */ - public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $calendarHome, bool $isResource, string $calendarUri, string $displayName, bool $exists, bool $hasExistingCalendars = false, bool $propertiesForPath = true): void { - /** @var PropFind $propFind */ + public function testPropFindDefaultCalendarUrl(string $principalUri, ?string $calendarHome, bool $isResource, string $calendarUri, string $displayName, bool $exists, bool $deleted = false, bool $hasExistingCalendars = false, bool $propertiesForPath = true): void { $propFind = new PropFind( $principalUri, [ @@ -328,6 +331,12 @@ class PluginTest extends TestCase { ->with($calendarUri) ->willReturn($exists); + if ($exists) { + $calendar = $this->createMock(Calendar::class); + $calendar->expects($this->once())->method('isDeleted')->willReturn($deleted); + $calendarHomeObject->expects($deleted && !$hasExistingCalendars ? $this->exactly(2) : $this->once())->method('getChild')->with($calendarUri)->willReturn($calendar); + } + $calendarBackend = $this->createMock(CalDavBackend::class); $calendarUri = $hasExistingCalendars ? 'custom' : $calendarUri; $displayName = $hasExistingCalendars ? 'Custom Calendar' : $displayName; @@ -349,7 +358,7 @@ class PluginTest extends TestCase { ) ] : []; - if (!$exists) { + if (!$exists || $deleted) { if (!$hasExistingCalendars) { $calendarBackend->expects($this->once()) ->method('createCalendar') |