'Sabre\\CalDAV\\Xml\\Request\CalendarQueryReport', ]; function testDeserialize() { $xml = << XML; $result = $this->parse($xml); $calendarQueryReport = new CalendarQueryReport(); $calendarQueryReport->properties = [ '{DAV:}getetag', ]; $calendarQueryReport->filters = [ 'name' => 'VCALENDAR', 'is-not-defined' => false, 'comp-filters' => [], 'prop-filters' => [], 'time-range' => false, ]; $this->assertEquals( $calendarQueryReport, $result['value'] ); } /** * @expectedException Sabre\DAV\Exception\BadRequest */ function testDeserializeNoFilter() { $xml = << XML; $this->parse($xml); } function testDeserializeComplex() { $xml = << hi Hello XML; $result = $this->parse($xml); $calendarQueryReport = new CalendarQueryReport(); $calendarQueryReport->version = '2.0'; $calendarQueryReport->contentType = 'application/json+calendar'; $calendarQueryReport->properties = [ '{DAV:}getetag', '{urn:ietf:params:xml:ns:caldav}calendar-data', ]; $calendarQueryReport->expand = [ 'start' => new \DateTime('2015-01-01 00:00:00', new \DateTimeZone('UTC')), 'end' => new \DateTime('2016-01-01 00:00:00', new \DateTimeZone('UTC')), ]; $calendarQueryReport->filters = [ 'name' => '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' => false, ], ], 'prop-filters' => [ [ 'name' => 'UID', 'is-not-defined' => false, 'time-range' => false, 'text-match' => null, 'param-filters' => [], ], [ 'name' => 'X-PROP', 'is-not-defined' => false, 'time-range' => false, 'text-match' => null, 'param-filters' => [ [ 'name' => 'X-PARAM', 'is-not-defined' => false, 'text-match' => null, ], [ 'name' => 'X-PARAM2', 'is-not-defined' => true, 'text-match' => null, ], [ 'name' => 'X-PARAM3', 'is-not-defined' => false, 'text-match' => [ 'negate-condition' => true, 'collation' => 'i;ascii-casemap', 'value' => 'hi', ], ], ], ], [ 'name' => 'X-PROP2', 'is-not-defined' => true, 'time-range' => false, 'text-match' => null, 'param-filters' => [], ], [ 'name' => 'X-PROP3', 'is-not-defined' => false, 'time-range' => [ 'start' => new \DateTime('2015-01-01 00:00:00', new \DateTimeZone('UTC')), 'end' => new \DateTime('2016-01-01 00:00:00', new \DateTimeZone('UTC')), ], 'text-match' => null, 'param-filters' => [], ], [ 'name' => 'X-PROP4', 'is-not-defined' => false, 'time-range' => false, 'text-match' => [ 'negate-condition' => false, 'collation' => 'i;ascii-casemap', 'value' => 'Hello', ], 'param-filters' => [], ], ], 'time-range' => [ 'start' => new \DateTime('2015-01-01 00:00:00', new \DateTimeZone('UTC')), 'end' => new \DateTime('2016-01-01 00:00:00', new \DateTimeZone('UTC')), ] ], ], 'prop-filters' => [], 'time-range' => false, ]; $this->assertEquals( $calendarQueryReport, $result['value'] ); } /** * @expectedException \Sabre\DAV\Exception\BadRequest */ function testDeserializeDoubleTopCompFilter() { $xml = << XML; $this->parse($xml); } /** * @expectedException \Sabre\DAV\Exception\BadRequest */ function testDeserializeMissingExpandEnd() { $xml = << XML; $this->parse($xml); } /** * @expectedException \Sabre\DAV\Exception\BadRequest */ function testDeserializeExpandEndBeforeStart() { $xml = << XML; $this->parse($xml); } /** * @expectedException \Sabre\DAV\Exception\BadRequest */ function testDeserializeTimeRangeOnVCALENDAR() { $xml = << XML; $this->parse($xml); } /** * @expectedException \Sabre\DAV\Exception\BadRequest */ function testDeserializeTimeRangeEndBeforeStart() { $xml = << XML; $this->parse($xml); } /** * @expectedException \Sabre\DAV\Exception\BadRequest */ function testDeserializeTimeRangePropEndBeforeStart() { $xml = << XML; $this->parse($xml); } }