@@ -732,6 +732,105 @@ function testCalendarQueryReport() {
732732
733733 }
734734
735+ /**
736+ * @depends testSupportedReportSetProperty
737+ * @depends testCalendarMultiGetReport
738+ */
739+ function testCalendarQueryReportWindowsPhone () {
740+
741+ $ body =
742+ '<?xml version="1.0"?> ' .
743+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:"> ' .
744+ '<d:prop> ' .
745+ ' <c:calendar-data> ' .
746+ ' <c:expand start="20000101T000000Z" end="20101231T235959Z" /> ' .
747+ ' </c:calendar-data> ' .
748+ ' <d:getetag /> ' .
749+ '</d:prop> ' .
750+ '<c:filter> ' .
751+ ' <c:comp-filter name="VCALENDAR"> ' .
752+ ' <c:comp-filter name="VEVENT" /> ' .
753+ ' </c:comp-filter> ' .
754+ '</c:filter> ' .
755+ '</c:calendar-query> ' ;
756+
757+ $ request = HTTP \Sapi::createFromServerArray (array (
758+ 'REQUEST_METHOD ' => 'REPORT ' ,
759+ 'REQUEST_URI ' => '/calendars/user1/UUID-123467 ' ,
760+ 'HTTP_USER_AGENT ' => 'MSFT-WP/8.10.14219 (gzip) ' ,
761+ 'HTTP_DEPTH ' => '0 ' ,
762+ ));
763+ $ request ->setBody ($ body );
764+
765+ $ this ->server ->httpRequest = $ request ;
766+ $ this ->server ->exec ();
767+
768+ $ this ->assertEquals (207 , $ this ->response ->status ,'Received an unexpected status. Full response body: ' . $ this ->response ->body );
769+
770+ $ expectedIcal = TestUtil::getTestCalendarData ();
771+ $ expectedIcal = \Sabre \VObject \Reader::read ($ expectedIcal );
772+ $ expectedIcal ->expand (
773+ new \DateTime ('2000-01-01 00:00:00 ' , new \DateTimeZone ('UTC ' )),
774+ new \DateTime ('2010-12-31 23:59:59 ' , new \DateTimeZone ('UTC ' ))
775+ );
776+ $ expectedIcal = str_replace ("\r\n" , "
 \n" , $ expectedIcal ->serialize ());
777+
778+ $ expected = <<<XML
779+ <?xml version="1.0"?>
780+ <d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
781+ <d:response>
782+ <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>
783+ <d:propstat>
784+ <d:prop>
785+ <cal:calendar-data> $ expectedIcal</cal:calendar-data>
786+ <d:getetag>"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag>
787+ </d:prop>
788+ <d:status>HTTP/1.1 200 OK</d:status>
789+ </d:propstat>
790+ </d:response>
791+ </d:multistatus>
792+ XML ;
793+
794+ $ this ->assertXmlStringEqualsXmlString ($ expected , $ this ->response ->getBodyAsString ());
795+
796+ }
797+
798+ /**
799+ * @depends testSupportedReportSetProperty
800+ * @depends testCalendarMultiGetReport
801+ */
802+ function testCalendarQueryReportBadDepth () {
803+
804+ $ body =
805+ '<?xml version="1.0"?> ' .
806+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:"> ' .
807+ '<d:prop> ' .
808+ ' <c:calendar-data> ' .
809+ ' <c:expand start="20000101T000000Z" end="20101231T235959Z" /> ' .
810+ ' </c:calendar-data> ' .
811+ ' <d:getetag /> ' .
812+ '</d:prop> ' .
813+ '<c:filter> ' .
814+ ' <c:comp-filter name="VCALENDAR"> ' .
815+ ' <c:comp-filter name="VEVENT" /> ' .
816+ ' </c:comp-filter> ' .
817+ '</c:filter> ' .
818+ '</c:calendar-query> ' ;
819+
820+ $ request = HTTP \Sapi::createFromServerArray (array (
821+ 'REQUEST_METHOD ' => 'REPORT ' ,
822+ 'REQUEST_URI ' => '/calendars/user1/UUID-123467 ' ,
823+ 'HTTP_DEPTH ' => '0 ' ,
824+ ));
825+ $ request ->setBody ($ body );
826+
827+ $ this ->server ->httpRequest = $ request ;
828+ $ this ->server ->exec ();
829+
830+ $ this ->assertEquals (400 , $ this ->response ->status ,'Received an unexpected status. Full response body: ' . $ this ->response ->body );
831+
832+ }
833+
735834 /**
736835 * @depends testCalendarQueryReport
737836 */
0 commit comments