当前位置: 首页>>代码示例>>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;未经允许,请勿转载。