assertEquals('foo', $notification->getId()); $this->assertEquals('"1"', $notification->getETag()); $simpleExpected = '' . "\n" . '' . "\n"; $dom = new \DOMDocument('1.0','UTF-8'); $elem = $dom->createElement('cs:root'); $elem->setAttribute('xmlns:cs',CalDAV\Plugin::NS_CALENDARSERVER); $dom->appendChild($elem); $notification->serialize(new DAV\Server(), $elem); $this->assertEquals($simpleExpected, $dom->saveXML()); $dom = new \DOMDocument('1.0','UTF-8'); $dom->formatOutput = true; $elem = $dom->createElement('cs:root'); $elem->setAttribute('xmlns:cs',CalDAV\Plugin::NS_CALENDARSERVER); $elem->setAttribute('xmlns:d','DAV:'); $elem->setAttribute('xmlns:cal',CalDAV\Plugin::NS_CALDAV); $dom->appendChild($elem); $notification->serializeBody(new DAV\Server(), $elem); $this->assertEquals($expected, $dom->saveXML()); } function dataProvider() { $dtStamp = new \DateTime('2012-01-01 00:00:00', new \DateTimeZone('GMT')); return array( array( array( 'id' => 'foo', 'dtStamp' => $dtStamp, 'etag' => '"1"', 'href' => 'mailto:foo@example.org', 'type' => CalDAV\SharingPlugin::STATUS_ACCEPTED, 'readOnly' => true, 'hostUrl' => 'calendar', 'organizer' => 'principal/user1', 'commonName' => 'John Doe', 'summary' => 'Awesome stuff!' ), << 20120101T000000Z foo mailto:foo@example.org /calendar John Doe /principal/user1 John Doe Awesome stuff! FOO ), array( array( 'id' => 'foo', 'dtStamp' => $dtStamp, 'etag' => '"1"', 'href' => 'mailto:foo@example.org', 'type' => CalDAV\SharingPlugin::STATUS_DECLINED, 'readOnly' => true, 'hostUrl' => 'calendar', 'organizer' => 'principal/user1', 'commonName' => 'John Doe', ), << 20120101T000000Z foo mailto:foo@example.org /calendar John Doe /principal/user1 John Doe FOO ), array( array( 'id' => 'foo', 'dtStamp' => $dtStamp, 'etag' => '"1"', 'href' => 'mailto:foo@example.org', 'type' => CalDAV\SharingPlugin::STATUS_NORESPONSE, 'readOnly' => true, 'hostUrl' => 'calendar', 'organizer' => 'principal/user1', 'firstName' => 'Foo', 'lastName' => 'Bar', ), << 20120101T000000Z foo mailto:foo@example.org /calendar Foo Bar /principal/user1 Foo Bar FOO ), array( array( 'id' => 'foo', 'dtStamp' => $dtStamp, 'etag' => '"1"', 'href' => 'mailto:foo@example.org', 'type' => CalDAV\SharingPlugin::STATUS_DELETED, 'readOnly' => false, 'hostUrl' => 'calendar', 'organizer' => 'mailto:user1@fruux.com', 'supportedComponents' => new CalDAV\Property\SupportedCalendarComponentSet(array('VEVENT','VTODO')), ), << 20120101T000000Z foo mailto:foo@example.org /calendar mailto:user1@fruux.com FOO ), ); } /** * @expectedException InvalidArgumentException */ function testMissingArg() { new Invite(array()); } /** * @expectedException InvalidArgumentException */ function testUnknownArg() { new Invite(array( 'foo-i-will-break' => true, 'id' => 1, 'etag' => '"bla"', 'href' => 'abc', 'dtStamp' => 'def', 'type' => 'ghi', 'readOnly' => true, 'hostUrl' => 'jkl', 'organizer' => 'mno', )); } }