當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Server::exposeVersion方法代碼示例

本文整理匯總了PHP中Sabre\DAV\Server::exposeVersion方法的典型用法代碼示例。如果您正苦於以下問題:PHP Server::exposeVersion方法的具體用法?PHP Server::exposeVersion怎麽用?PHP Server::exposeVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sabre\DAV\Server的用法示例。


在下文中一共展示了Server::exposeVersion方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testBeforeMethodNoVersion

 function testBeforeMethodNoVersion()
 {
     if (!SABRE_HASSQLITE) {
         $this->markTestSkipped('SQLite driver is not available');
     }
     $cbackend = TestUtil::getBackend();
     $props = array('uri' => 'UUID-123467', 'principaluri' => 'admin', 'id' => 1);
     $tree = array(new Calendar($cbackend, $props));
     $p = new ICSExportPlugin();
     $s = new DAV\Server($tree);
     $s->addPlugin($p);
     $s->addPlugin(new Plugin());
     $h = new HTTP\Request(array('QUERY_STRING' => 'export'));
     $s->httpRequest = $h;
     $s->httpResponse = new HTTP\ResponseMock();
     DAV\Server::$exposeVersion = false;
     $this->assertFalse($p->beforeMethod('GET', 'UUID-123467?export'));
     DAV\Server::$exposeVersion = true;
     $this->assertEquals('HTTP/1.1 200 OK', $s->httpResponse->status);
     $this->assertEquals(array('Content-Type' => 'text/calendar'), $s->httpResponse->headers);
     $obj = VObject\Reader::read($s->httpResponse->body);
     $this->assertEquals(5, count($obj->children()));
     $this->assertEquals(1, count($obj->VERSION));
     $this->assertEquals(1, count($obj->CALSCALE));
     $this->assertEquals(1, count($obj->PRODID));
     $this->assertFalse(strpos((string) $obj->PRODID, DAV\Version::VERSION) !== false);
     $this->assertEquals(1, count($obj->VTIMEZONE));
     $this->assertEquals(1, count($obj->VEVENT));
 }
開發者ID:samj1912,項目名稱:repo,代碼行數:29,代碼來源:ICSExportPluginTest.php

示例2: testBeforeMethodNoVersion

 function testBeforeMethodNoVersion()
 {
     if (!SABRE_HASSQLITE) {
         $this->markTestSkipped('SQLite driver is not available');
     }
     $cbackend = TestUtil::getBackend();
     $props = ['uri' => 'UUID-123467', 'principaluri' => 'admin', 'id' => 1];
     $tree = [new Calendar($cbackend, $props)];
     $p = new ICSExportPlugin();
     $s = new DAV\Server($tree);
     $s->addPlugin($p);
     $s->addPlugin(new Plugin());
     $h = HTTP\Sapi::createFromServerArray(['REQUEST_URI' => '/UUID-123467?export', 'REQUEST_METHOD' => 'GET']);
     $s->httpRequest = $h;
     $s->httpResponse = new HTTP\ResponseMock();
     DAV\Server::$exposeVersion = false;
     $this->assertFalse($p->httpGet($h, $s->httpResponse));
     DAV\Server::$exposeVersion = true;
     $this->assertEquals(200, $s->httpResponse->status);
     $this->assertEquals(['Content-Type' => 'text/calendar'], $s->httpResponse->getHeaders());
     $obj = VObject\Reader::read($s->httpResponse->body);
     $this->assertEquals(5, count($obj->children()));
     $this->assertEquals(1, count($obj->VERSION));
     $this->assertEquals(1, count($obj->CALSCALE));
     $this->assertEquals(1, count($obj->PRODID));
     $this->assertFalse(strpos((string) $obj->PRODID, DAV\Version::VERSION) !== false);
     $this->assertEquals(1, count($obj->VTIMEZONE));
     $this->assertEquals(1, count($obj->VEVENT));
 }
開發者ID:mattes,項目名稱:sabre-dav,代碼行數:29,代碼來源:ICSExportPluginTest.php

示例3: testBeforeMethodNoVersion

 function testBeforeMethodNoVersion()
 {
     $request = new HTTP\Request('GET', '/calendars/admin/UUID-123467?export');
     DAV\Server::$exposeVersion = false;
     $response = $this->request($request);
     DAV\Server::$exposeVersion = true;
     $this->assertEquals(200, $response->getStatus());
     $this->assertEquals('text/calendar', $response->getHeader('Content-Type'));
     $obj = VObject\Reader::read($response->body);
     $this->assertEquals(8, count($obj->children()));
     $this->assertEquals(1, count($obj->VERSION));
     $this->assertEquals(1, count($obj->CALSCALE));
     $this->assertEquals(1, count($obj->PRODID));
     $this->assertFalse(strpos((string) $obj->PRODID, DAV\Version::VERSION) !== false);
     $this->assertEquals(1, count($obj->VTIMEZONE));
     $this->assertEquals(1, count($obj->VEVENT));
 }
開發者ID:BlaBlaNet,項目名稱:hubzilla,代碼行數:17,代碼來源:ICSExportPluginTest.php


注:本文中的Sabre\DAV\Server::exposeVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。