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


PHP Server::expects方法代碼示例

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


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

示例1: testOnReport

 public function testOnReport()
 {
     $path = 'comments/files/42';
     $parameters = [['name' => '{http://owncloud.org/ns}limit', 'value' => 5], ['name' => '{http://owncloud.org/ns}offset', 'value' => 10], ['name' => '{http://owncloud.org/ns}datetime', 'value' => '2016-01-10 18:48:00']];
     $node = $this->getMockBuilder('\\OCA\\DAV\\Comments\\EntityCollection')->disableOriginalConstructor()->getMock();
     $node->expects($this->once())->method('findChildren')->with(5, 10, new \DateTime($parameters[2]['value']))->will($this->returnValue([]));
     $response = $this->getMockBuilder('Sabre\\HTTP\\ResponseInterface')->disableOriginalConstructor()->getMock();
     $response->expects($this->once())->method('setHeader')->with('Content-Type', 'application/xml; charset=utf-8');
     $response->expects($this->once())->method('setStatus')->with(207);
     $response->expects($this->once())->method('setBody');
     $this->tree->expects($this->any())->method('getNodeForPath')->with('/' . $path)->will($this->returnValue($node));
     $this->server->expects($this->any())->method('getRequestUri')->will($this->returnValue($path));
     $this->server->httpResponse = $response;
     $this->plugin->initialize($this->server);
     $this->plugin->onReport(CommentsPluginImplementation::REPORT_NAME, $parameters, '/' . $path);
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:16,代碼來源:CommentsPluginTest.php

示例2: testOnReport

 public function testOnReport()
 {
     $path = 'test';
     $parameters = [['name' => '{DAV:}prop', 'value' => [['name' => '{DAV:}getcontentlength', 'value' => ''], ['name' => '{http://owncloud.org/ns}size', 'value' => '']]], ['name' => '{http://owncloud.org/ns}filter-rules', 'value' => [['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'], ['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456']]]];
     $this->groupManager->expects($this->any())->method('isAdmin')->will($this->returnValue(true));
     $this->tagMapper->expects($this->at(0))->method('getObjectIdsForTags')->with('123', 'files')->will($this->returnValue(['111', '222']));
     $this->tagMapper->expects($this->at(1))->method('getObjectIdsForTags')->with('456', 'files')->will($this->returnValue(['111', '222', '333']));
     $reportTargetNode = $this->getMockBuilder('\\OCA\\DAV\\Connector\\Sabre\\Directory')->disableOriginalConstructor()->getMock();
     $response = $this->getMockBuilder('Sabre\\HTTP\\ResponseInterface')->disableOriginalConstructor()->getMock();
     $response->expects($this->once())->method('setHeader')->with('Content-Type', 'application/xml; charset=utf-8');
     $response->expects($this->once())->method('setStatus')->with(207);
     $response->expects($this->once())->method('setBody');
     $this->tree->expects($this->any())->method('getNodeForPath')->with('/' . $path)->will($this->returnValue($reportTargetNode));
     $filesNode1 = $this->getMockBuilder('\\OCP\\Files\\Folder')->disableOriginalConstructor()->getMock();
     $filesNode2 = $this->getMockBuilder('\\OCP\\Files\\File')->disableOriginalConstructor()->getMock();
     $this->userFolder->expects($this->at(0))->method('getById')->with('111')->will($this->returnValue([$filesNode1]));
     $this->userFolder->expects($this->at(1))->method('getById')->with('222')->will($this->returnValue([$filesNode2]));
     $this->server->expects($this->any())->method('getRequestUri')->will($this->returnValue($path));
     $this->server->httpResponse = $response;
     $this->plugin->initialize($this->server);
     $this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, $parameters, '/' . $path);
 }
開發者ID:gvde,項目名稱:core,代碼行數:22,代碼來源:filesreportplugin.php


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