#1C4587FF Jewish holidays Foo 19 webcal://www.example.org/ P1W XML; $headers = [ 'Content-Type' => 'application/xml', ]; $request = new Request('MKCOL', '/calendars/user1/subscription1', $headers, $body); $response = $this->request($request); $this->assertEquals(201, $response->getStatus()); $subscriptions = $this->caldavBackend->getSubscriptionsForUser('principals/user1'); $this->assertSubscription($subscriptions[0]); } /** * OS X 10.9.2 and up */ function testMKCALENDAR() { $body = << P1W webcal://www.example.org/ #1C4587FF 19 Foo Jewish holidays XML; $headers = [ 'Content-Type' => 'application/xml', ]; $request = new Request('MKCALENDAR', '/calendars/user1/subscription1', $headers, $body); $response = $this->request($request); $this->assertEquals(201, $response->getStatus()); $subscriptions = $this->caldavBackend->getSubscriptionsForUser('principals/user1'); $this->assertSubscription($subscriptions[0]); // Also seeing if it works when calling this as a PROPFIND. $this->assertEquals([ '{http://calendarserver.org/ns/}subscribed-strip-alarms' => '', ], $this->server->getProperties('calendars/user1/subscription1', ['{http://calendarserver.org/ns/}subscribed-strip-alarms']) ); } function assertSubscription($subscription) { $this->assertEquals('', $subscription['{http://calendarserver.org/ns/}subscribed-strip-attachments']); $this->assertEquals('', $subscription['{http://calendarserver.org/ns/}subscribed-strip-todos']); $this->assertEquals('#1C4587FF', $subscription['{http://apple.com/ns/ical/}calendar-color']); $this->assertEquals('Jewish holidays', $subscription['{DAV:}displayname']); $this->assertEquals('Foo', $subscription['{urn:ietf:params:xml:ns:caldav}calendar-description']); $this->assertEquals('19', $subscription['{http://apple.com/ns/ical/}calendar-order']); $this->assertEquals('webcal://www.example.org/', $subscription['{http://calendarserver.org/ns/}source']->getHref()); $this->assertEquals('P1W', $subscription['{http://apple.com/ns/ical/}refreshrate']); $this->assertEquals('subscription1', $subscription['uri']); $this->assertEquals('principals/user1', $subscription['principaluri']); $this->assertEquals('webcal://www.example.org/', $subscription['source']); $this->assertEquals(['principals/user1', 1], $subscription['id']); } }