From f8f79e42eea78c9ec1345eb49685e4d3b200bb8a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 5 Dec 2025 15:36:43 +0100 Subject: [PATCH 1/3] Add test for #1000 --- tests/Sabre/CalDAV/Issue1000Test.php | 99 ++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 tests/Sabre/CalDAV/Issue1000Test.php diff --git a/tests/Sabre/CalDAV/Issue1000Test.php b/tests/Sabre/CalDAV/Issue1000Test.php new file mode 100644 index 0000000000..3fa2167a5a --- /dev/null +++ b/tests/Sabre/CalDAV/Issue1000Test.php @@ -0,0 +1,99 @@ + 1, + 'name' => 'Calendar', + 'principaluri' => 'principals/user1', + 'uri' => 'calendar1', + ], + ]; + + protected $caldavCalendarObjects = [ + 1 => [ + 'event1.ics' => [ + 'calendardata' => 'BEGIN:VCALENDAR +VERSION:2.0 +BEGIN:VEVENT +UID:1111 +DTSTAMP:20120418T152519Z +DTSTART;VALUE=DATE:20120330 +DTEND;VALUE=DATE:20120531 +SEQUENCE:1 +SUMMARY:Birthday1 +TRANSP:TRANSPARENT +BEGIN:VALARM +ACTION:EMAIL +ATTENDEE:MAILTO:xxx@domain.de +TRIGGER;VALUE=DATE-TIME:20120329T060000Z +END:VALARM +END:VEVENT +END:VCALENDAR +', + ], + 'event2.ics' => [ + 'calendardata' => 'BEGIN:VCALENDAR +VERSION:2.0 +BEGIN:VEVENT +UID:1234 +DTSTAMP:20120418T152519Z +DTSTART;VALUE=DATE:20120330 +DTEND;VALUE=DATE:20120531 +SEQUENCE:1 +SUMMARY:Birthday2 +TRANSP:TRANSPARENT +END:VEVENT +END:VCALENDAR +', + ], + ], + ]; + + public function testIssue211() + { + $request = HTTP\Sapi::createFromServerArray([ + 'REQUEST_METHOD' => 'REPORT', + 'HTTP_CONTENT_TYPE' => 'application/xml', + 'REQUEST_URI' => '/calendars/user1/calendar1', + 'HTTP_DEPTH' => '1', + ]); + + $request->setBody(' + + + + + + + + + + + + + +'); + + $response = $this->request($request); + + self::assertTrue(strpos($response->getBodyAsString(), 'event2.ics') > 0); + self::assertTrue(strpos($response->getBodyAsString(), 'event1.ics') === false); + } +} From abc472219313ca93eb2deda2bb9384b4661ddad3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 5 Dec 2025 15:39:43 +0100 Subject: [PATCH 2/3] Fix CS issue --- tests/Sabre/CalDAV/Issue1000Test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Sabre/CalDAV/Issue1000Test.php b/tests/Sabre/CalDAV/Issue1000Test.php index 3fa2167a5a..de312d9a83 100644 --- a/tests/Sabre/CalDAV/Issue1000Test.php +++ b/tests/Sabre/CalDAV/Issue1000Test.php @@ -94,6 +94,6 @@ public function testIssue211() $response = $this->request($request); self::assertTrue(strpos($response->getBodyAsString(), 'event2.ics') > 0); - self::assertTrue(strpos($response->getBodyAsString(), 'event1.ics') === false); + self::assertTrue(false === strpos($response->getBodyAsString(), 'event1.ics')); } } From 46c46d43a84b20fef37490d50e7d709245baef11 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 11 Dec 2025 15:21:02 +0100 Subject: [PATCH 3/3] Add PDO backend test --- .../CalDAV/Backend/AbstractPDOTestCase.php | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php b/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php index 8b6de11539..3209366ad2 100644 --- a/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php +++ b/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php @@ -903,6 +903,72 @@ public function testCalendarQueryTimeRangeNotSpecified() self::assertTrue(in_array('event2', $result)); } + public function testCalendarQueryGH1000() + { + $backend = new PDO($this->pdo); + $backend->createCalendarObject([1, 1], 'event1', <<createCalendarObject([1, 1], 'event2', << 'VCALENDAR', + 'is-not-defined' => false, + 'comp-filters' => [ + [ + 'name' => 'VEVENT', + 'is-not-defined' => false, + 'comp-filters' => [ + [ + 'name' => 'VALARM', + 'is-not-defined' => true, + 'comp-filters' => [], + 'prop-filters' => [], + 'time-range' => null, + ], + ], + 'prop-filters' => [], + 'time-range' => false, + ], + ], + 'prop-filters' => [], + 'time-range' => null, + ]; + + $result = $backend->calendarQuery([1, 1], $filters); + self::assertFalse(in_array('event1', $result)); + self::assertTrue(in_array('event2', $result)); + } + public function testGetChanges() { $backend = new PDO($this->pdo);