Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/CachedSubscriptionImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getUri(): string {
*/
#[\Override]
public function getDisplayName(): ?string {
return $this->calendarInfo['{DAV:}displayname'];
return $this->calendarInfo['{DAV:}displayname'] ?? null;
}

/**
Expand All @@ -57,7 +57,7 @@ public function getDisplayName(): ?string {
*/
#[\Override]
public function getDisplayColor(): ?string {
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'] ?? null;
}

#[\Override]
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/CalendarImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function getOwnerPrincipalUri(): string {
*/
#[\Override]
public function getDisplayName(): ?string {
return $this->calendarInfo['{DAV:}displayname'];
return $this->calendarInfo['{DAV:}displayname'] ?? null;
}

/**
Expand All @@ -92,7 +92,7 @@ public function getDisplayName(): ?string {
*/
#[\Override]
public function getDisplayColor(): ?string {
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'] ?? null;
}

public function getSchedulingTransparency(): ?ScheduleCalendarTransp {
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/Federation/FederatedCalendarImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public function getUri(): string {

#[\Override]
public function getDisplayName(): ?string {
return $this->calendarInfo['{DAV:}displayname'];
return $this->calendarInfo['{DAV:}displayname'] ?? null;
}

#[\Override]
public function getDisplayColor(): ?string {
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'] ?? null;
}

#[\Override]
Expand Down
14 changes: 14 additions & 0 deletions apps/dav/tests/unit/CalDAV/CachedSubscriptionImplTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ public function testGetDisplayColor(): void {
$this->assertEquals($this->cachedSubscriptionImpl->getDisplayColor(), '#AABBCC');
}

public function testGetDisplayPropertiesWhenMissing(): void {
$calendarInfo = $this->cachedSubscriptionInfo;
unset($calendarInfo['{DAV:}displayname']);
unset($calendarInfo['{http://apple.com/ns/ical/}calendar-color']);
$cachedSubscriptionImpl = new CachedSubscriptionImpl(
$this->cachedSubscription,
$calendarInfo,
$this->backend
);

$this->assertNull($cachedSubscriptionImpl->getDisplayName());
$this->assertNull($cachedSubscriptionImpl->getDisplayColor());
}

public function testGetSource(): void {
$this->assertEquals($this->cachedSubscriptionImpl->getSource(), 'https://test.localhost/calendar1');
}
Expand Down
10 changes: 10 additions & 0 deletions apps/dav/tests/unit/CalDAV/CalendarImplTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public function testGetDisplayColor(): void {
$this->assertEquals($this->calendarImpl->getDisplayColor(), '#AABBCC');
}

public function testGetDisplayPropertiesWhenMissing(): void {
$calendarInfo = $this->calendarInfo;
unset($calendarInfo['{DAV:}displayname']);
unset($calendarInfo['{http://apple.com/ns/ical/}calendar-color']);
$calendarImpl = new CalendarImpl($this->calendar, $calendarInfo, $this->backend);

$this->assertNull($calendarImpl->getDisplayName());
$this->assertNull($calendarImpl->getDisplayColor());
}

public function testGetPublicToken(): void {
$publicToken = $this->calendar->setPublishStatus(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ protected function setUp(): void {
);
}

public function testGetDisplayPropertiesWhenMissing(): void {
$this->assertNull($this->federatedCalendarImpl->getDisplayName());
$this->assertNull($this->federatedCalendarImpl->getDisplayColor());
}

public function testGetPermissions(): void {
$this->assertEquals(1, $this->federatedCalendarImpl->getPermissions());
}
Expand Down
Loading