assertEquals('foo', $notification->getId()); $this->assertEquals('"1"', $notification->getETag()); $simpleExpected = '' . "\n" . ''; $writer = new Writer(); $writer->namespaceMap = [ 'http://calendarserver.org/ns/' => 'cs', ]; $writer->openMemory(); $writer->startDocument('1.0', 'UTF-8'); $writer->startElement('{http://calendarserver.org/ns/}root'); $writer->write($notification); $writer->endElement(); $this->assertEquals($simpleExpected, $writer->outputMemory()); $writer = new Writer(); $writer->contextUri = '/'; $writer->namespaceMap = [ 'http://calendarserver.org/ns/' => 'cs', 'DAV:' => 'd', ]; $writer->openMemory(); $writer->startDocument('1.0', 'UTF-8'); $writer->startElement('{http://calendarserver.org/ns/}root'); $notification->xmlSerializeFull($writer); $writer->endElement(); $this->assertXmlStringEqualsXmlString($expected, $writer->outputMemory()); } function dataProvider() { $dtStamp = new \DateTime('2012-01-01 00:00:00 GMT'); return array( array( array( 'id' => 'foo', 'dtStamp' => $dtStamp, 'etag' => '"1"', 'inReplyTo' => 'bar', 'href' => 'mailto:foo@example.org', 'type' => CalDAV\SharingPlugin::STATUS_ACCEPTED, 'hostUrl' => 'calendar' ), << 20120101T000000Z foo bar mailto:foo@example.org /calendar FOO ), array( array( 'id' => 'foo', 'dtStamp' => $dtStamp, 'etag' => '"1"', 'inReplyTo' => 'bar', 'href' => 'mailto:foo@example.org', 'type' => CalDAV\SharingPlugin::STATUS_DECLINED, 'hostUrl' => 'calendar', 'summary' => 'Summary!' ), << 20120101T000000Z foo bar mailto:foo@example.org /calendar Summary! FOO ), ); } /** * @expectedException InvalidArgumentException */ function testMissingArg() { new InviteReply(array()); } /** * @expectedException InvalidArgumentException */ function testUnknownArg() { new InviteReply(array( 'foo-i-will-break' => true, 'id' => 1, 'etag' => '"bla"', 'href' => 'abc', 'dtStamp' => 'def', 'inReplyTo' => 'qrs', 'type' => 'ghi', 'hostUrl' => 'jkl', )); } }