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


PHP IURLGenerator::method方法代碼示例

本文整理匯總了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());
 }
開發者ID:ZverAleksey,項目名稱:core,代碼行數:28,代碼來源:share20ocstest.php

示例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());
 }
開發者ID:gcstang,項目名稱:core,代碼行數:15,代碼來源:share20ocstest.php

示例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);
     }
 }
開發者ID:gvde,項目名稱:core,代碼行數:22,代碼來源:share20ocstest.php


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