예제 #1
0
    function testNotificationGet()
    {
        $notification = new Node($this->caldavBackend, 'principals/user1', new Notification\SystemStatus('foo', '"1"'));
        $server = new DAV\Server(array($notification));
        $caldav = new Plugin();
        $server->httpRequest = HTTP\Sapi::createFromServerArray(array('REQUEST_URI' => '/foo.xml'));
        $httpResponse = new HTTP\ResponseMock();
        $server->httpResponse = $httpResponse;
        $server->addPlugin($caldav);
        $caldav->httpGet($server->httpRequest, $server->httpResponse);
        $this->assertEquals(200, $httpResponse->status);
        $this->assertEquals(array('Content-Type' => ['application/xml'], 'ETag' => ['"1"']), $httpResponse->getHeaders());
        $expected = '<?xml version="1.0" encoding="UTF-8"?>
<cs:notification xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:cs="http://calendarserver.org/ns/">
  <cs:systemstatus type="high"/>
</cs:notification>
';
        $this->assertEquals($expected, $httpResponse->body);
    }
예제 #2
0
    function testNotificationGet()
    {
        $notification = new Node($this->caldavBackend, 'principals/user1', new SystemStatus('foo', '"1"'));
        $server = new DAV\Server([$notification]);
        $caldav = new Plugin();
        $server->httpRequest = new Request('GET', '/foo.xml');
        $httpResponse = new HTTP\ResponseMock();
        $server->httpResponse = $httpResponse;
        $server->addPlugin($caldav);
        $caldav->httpGet($server->httpRequest, $server->httpResponse);
        $this->assertEquals(200, $httpResponse->status);
        $this->assertEquals(['Content-Type' => ['application/xml'], 'ETag' => ['"1"']], $httpResponse->getHeaders());
        $expected = '<?xml version="1.0" encoding="UTF-8"?>
<cs:notification xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:cs="http://calendarserver.org/ns/">
 <cs:systemstatus type="high"/>
</cs:notification>
';
        $this->assertXmlStringEqualsXmlString($expected, $httpResponse->getBodyAsString());
    }