本文整理汇总了PHP中OCP\IURLGenerator::method方法的典型用法代码示例。如果您正苦于以下问题:PHP IURLGenerator::method方法的具体用法?PHP IURLGenerator::method怎么用?PHP IURLGenerator::method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\IURLGenerator
的用法示例。
在下文中一共展示了IURLGenerator::method方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetShare
/**
* @dataProvider dataGetShare
*/
public function testGetShare(\OCP\Share\IShare $share, array $result)
{
$ocs = $this->getMockBuilder('OCA\\Files_Sharing\\API\\Share20OCS')->setConstructorArgs([$this->shareManager, $this->groupManager, $this->userManager, $this->request, $this->rootFolder, $this->urlGenerator, $this->currentUser])->setMethods(['canAccessShare'])->getMock();
$ocs->method('canAccessShare')->willReturn(true);
$this->shareManager->expects($this->once())->method('getShareById')->with($share->getFullId())->willReturn($share);
$userFolder = $this->getMock('OCP\\Files\\Folder');
$userFolder->method('getRelativePath')->will($this->returnArgument(0));
$this->rootFolder->method('getUserFolder')->with($share->getShareOwner())->willReturn($userFolder);
$this->urlGenerator->method('linkToRouteAbsolute')->willReturn('url');
$initiator = $this->getMock('OCP\\IUser');
$initiator->method('getUID')->willReturn('initiatorId');
$initiator->method('getDisplayName')->willReturn('initiatorDisplay');
$owner = $this->getMock('OCP\\IUser');
$owner->method('getUID')->willReturn('ownerId');
$owner->method('getDisplayName')->willReturn('ownerDisplay');
$user = $this->getMock('OCP\\IUser');
$user->method('getUID')->willReturn('userId');
$user->method('getDisplayName')->willReturn('userDisplay');
$group = $this->getMock('OCP\\IGroup');
$group->method('getGID')->willReturn('groupId');
$this->userManager->method('get')->will($this->returnValueMap([['userId', $user], ['initiatorId', $initiator], ['ownerId', $owner]]));
$this->groupManager->method('get')->will($this->returnValueMap([['group', $group]]));
$expected = new \OC_OCS_Result([$result]);
$this->assertEquals($expected->getData(), $ocs->getShare($share->getId())->getData());
}
示例2: testGetShare
/**
* @dataProvider dataGetShare
*/
public function testGetShare(\OC\Share20\IShare $share, array $result)
{
$ocs = $this->getMockBuilder('OCA\\Files_Sharing\\API\\Share20OCS')->setConstructorArgs([$this->shareManager, $this->groupManager, $this->userManager, $this->request, $this->rootFolder, $this->urlGenerator, $this->currentUser])->setMethods(['canAccessShare'])->getMock();
$ocs->method('canAccessShare')->willReturn(true);
$this->shareManager->expects($this->once())->method('getShareById')->with($share->getId())->willReturn($share);
$userFolder = $this->getMock('OCP\\Files\\Folder');
$userFolder->method('getRelativePath')->will($this->returnArgument(0));
$this->rootFolder->method('getUserFolder')->with($share->getShareOwner()->getUID())->willReturn($userFolder);
$this->urlGenerator->method('linkToRouteAbsolute')->willReturn('url');
$expected = new \OC_OCS_Result($result);
$this->assertEquals($expected->getData(), $ocs->getShare($share->getId())->getData());
}
示例3: testFormatShare
/**
* @dataProvider dataFormatShare
*
* @param array $expects
* @param \OCP\Share\IShare $share
* @param array $users
* @param $exception
*/
public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception)
{
$this->userManager->method('get')->will($this->returnValueMap($users));
$this->urlGenerator->method('linkToRouteAbsolute')->with('files_sharing.sharecontroller.showShare', ['token' => 'myToken'])->willReturn('myLink');
$this->rootFolder->method('getUserFolder')->with($share->getShareOwner())->will($this->returnSelf());
$this->rootFolder->method('getRelativePath')->will($this->returnArgument(0));
try {
$result = $this->invokePrivate($this->ocs, 'formatShare', [$share]);
$this->assertFalse($exception);
$this->assertEquals($expects, $result);
} catch (NotFoundException $e) {
$this->assertTrue($exception);
}
}