/**
 * @param Sabre_DAV_Server $server
 * @param Sabre_CalDAV_Calendar $calendar
 * @param string $calendarobject_uri
 * @param string $with_privilege
 * @return null|Sabre\VObject\Component\VCalendar
 */
function dav_get_current_user_calendarobject(&$server, &$calendar, $calendarobject_uri, $with_privilege = "")
{
    $obj = $calendar->getChild($calendarobject_uri);
    if ($with_privilege == "") {
        $with_privilege = DAV_ACL_READ;
    }
    $a = get_app();
    $uri = "/calendars/" . strtolower($a->user["nickname"]) . "/" . $calendar->getName() . "/" . $calendarobject_uri;
    /** @var Sabre_DAVACL_Plugin $aclplugin  */
    $aclplugin = $server->getPlugin("acl");
    if (!$aclplugin->checkPrivileges($uri, $with_privilege, Sabre_DAVACL_Plugin::R_PARENT, false)) {
        return null;
    }
    $data = $obj->get();
    $vObject = Sabre\VObject\Reader::read($data);
    return $vObject;
}
 function testSimple()
 {
     $this->assertEquals($this->calendars[0]['uri'], $this->calendar->getName());
 }