本文整理汇总了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);
}
示例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);
}