本文整理匯總了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);
}
}