当前位置: 首页>>代码示例>>PHP>>正文


PHP IUser::expects方法代码示例

本文整理汇总了PHP中OCP\IUser::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP IUser::expects方法的具体用法?PHP IUser::expects怎么用?PHP IUser::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\IUser的用法示例。


在下文中一共展示了IUser::expects方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     $this->server = new \Sabre\DAV\Server();
     $this->tree = $this->getMockBuilder('\\Sabre\\DAV\\Tree')->disableOriginalConstructor()->getMock();
     $userId = $this->getUniqueID('testcustompropertiesuser');
     $this->user = $this->getMock('\\OCP\\IUser');
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue($userId));
     $this->plugin = new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend($this->tree, \OC::$server->getDatabaseConnection(), $this->user);
 }
开发者ID:rajeshpillai,项目名称:core,代码行数:10,代码来源:custompropertiesbackend.php

示例2: prepareForInitCollections

 protected function prepareForInitCollections()
 {
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue('alice'));
     $this->userSession->expects($this->once())->method('getUser')->will($this->returnValue($this->user));
     $this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
         $event->addEntityCollection('files', function () {
             return true;
         });
     });
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:10,代码来源:RootCollectionTest.php

示例3: getNode

 public function getNode($isAdmin = true)
 {
     $this->user = $this->getMock('\\OCP\\IUser');
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue('testuser'));
     $userSession = $this->getMock('\\OCP\\IUserSession');
     $userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
     $groupManager = $this->getMock('\\OCP\\IGroupManager');
     $groupManager->expects($this->any())->method('isAdmin')->with('testuser')->will($this->returnValue($isAdmin));
     return new \OCA\DAV\SystemTag\SystemTagsByIdCollection($this->tagManager, $userSession, $groupManager);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:10,代码来源:SystemTagsByIdCollectionTest.php

示例4: setUp

 public function setUp()
 {
     $this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->user = $this->getMock('\\OCP\\IUser');
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue('user1'));
     $userSession = $this->getMock('\\OCP\\IUserSession');
     $userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
     $this->tagService = $this->getMockBuilder('\\OCA\\Files\\Service\\TagService')->disableOriginalConstructor()->getMock();
     $this->shareManager = $this->getMockBuilder('\\OCP\\Share\\IManager')->disableOriginalConstructor()->getMock();
     $this->preview = $this->getMockBuilder('\\OCP\\IPreview')->disableOriginalConstructor()->getMock();
     $this->config = $this->getMock('\\OCP\\IConfig');
     $this->apiController = new ApiController($this->appName, $this->request, $userSession, $this->tagService, $this->preview, $this->shareManager, $this->config);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:13,代码来源:ApiControllerTest.php

示例5: testSingleBucket

 public function testSingleBucket()
 {
     $this->config->expects($this->once())->method('getSystemValue')->with($this->equalTo('objectstore'), '')->willReturn(['class' => 'Test\\Files\\Mount\\FakeObjectStore']);
     $this->user->expects($this->never())->method($this->anything());
     $this->loader->expects($this->never())->method($this->anything());
     $config = $this->invokePrivate($this->provider, 'getSingleBucketObjectStoreConfig', [$this->user, $this->loader]);
     $this->assertArrayHasKey('class', $config);
     $this->assertEquals($config['class'], 'Test\\Files\\Mount\\FakeObjectStore');
     $this->assertArrayHasKey('arguments', $config);
     $this->assertArrayHasKey('user', $config['arguments']);
     $this->assertSame($this->user, $config['arguments']['user']);
     $this->assertArrayHasKey('objectstore', $config['arguments']);
     $this->assertInstanceOf('Test\\Files\\Mount\\FakeObjectStore', $config['arguments']['objectstore']);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:14,代码来源:ObjectHomeMountProviderTest.php

示例6: testMergeShares

 /**
  * Tests merging shares.
  *
  * Happens when sharing the same entry to a user through multiple ways,
  * like several groups and also direct shares at the same time.
  *
  * @dataProvider mergeSharesDataProvider
  *
  * @param array $userShares array of user share specs
  * @param array $groupShares array of group share specs
  * @param array $expectedShares array of expected supershare specs
  */
 public function testMergeShares($userShares, $groupShares, $expectedShares)
 {
     $rootFolder = $this->getMock('\\OCP\\Files\\IRootFolder');
     $userManager = $this->getMock('\\OCP\\IUserManager');
     $userShares = array_map(function ($shareSpec) {
         return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]);
     }, $userShares);
     $groupShares = array_map(function ($shareSpec) {
         return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]);
     }, $groupShares);
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue('user1'));
     $this->shareManager->expects($this->at(0))->method('getSharedWith')->with('user1', \OCP\Share::SHARE_TYPE_USER)->will($this->returnValue($userShares));
     $this->shareManager->expects($this->at(1))->method('getSharedWith')->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1)->will($this->returnValue($groupShares));
     $this->shareManager->expects($this->any())->method('newShare')->will($this->returnCallback(function () use($rootFolder, $userManager) {
         return new \OC\Share20\Share($rootFolder, $userManager);
     }));
     $mounts = $this->provider->getMountsForUser($this->user, $this->loader);
     $this->assertCount(count($expectedShares), $mounts);
     foreach ($mounts as $index => $mount) {
         $expectedShare = $expectedShares[$index];
         $this->assertInstanceOf('OCA\\Files_Sharing\\SharedMount', $mount);
         // supershare
         $share = $mount->getShare();
         $this->assertEquals($expectedShare[0], $share->getId());
         $this->assertEquals($expectedShare[1], $share->getNodeId());
         $this->assertEquals($expectedShare[2], $share->getShareOwner());
         $this->assertEquals($expectedShare[3], $share->getTarget());
         $this->assertEquals($expectedShare[4], $share->getPermissions());
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:42,代码来源:MountProviderTest.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $this->request = $this->getMock('\\OCP\\IRequest');
     $this->urlGenerator = $this->getMock('\\OCP\\IURLGenerator');
     $this->navigationManager = $this->getMock('\\OCP\\INavigationManager');
     $this->l10n = $this->getMock('\\OCP\\IL10N');
     $this->config = $this->getMock('\\OCP\\IConfig');
     $this->eventDispatcher = $this->getMock('\\Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->userSession = $this->getMock('\\OCP\\IUserSession');
     $this->appManager = $this->getMock('\\OCP\\App\\IAppManager');
     $this->user = $this->getMock('\\OCP\\IUser');
     $this->user->expects($this->any())->method('getUID')->will($this->returnValue('testuser1'));
     $this->userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
     $this->rootFolder = $this->getMock('\\OCP\\Files\\Folder');
     $this->viewController = $this->getMockBuilder('\\OCA\\Files\\Controller\\ViewController')->setConstructorArgs(['files', $this->request, $this->urlGenerator, $this->navigationManager, $this->l10n, $this->config, $this->eventDispatcher, $this->userSession, $this->appManager, $this->rootFolder])->setMethods(['getStorageInfo', 'renderScript'])->getMock();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:17,代码来源:ViewControllerTest.php

示例8: setUp

 protected function setUp()
 {
     $this->existingUser = $this->getMockBuilder('OCP\\IUser')->disableOriginalConstructor()->getMock();
     $this->existingUser->expects($this->any())->method('getEMailAddress')->willReturn('test@example.com');
     $this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($text, $parameters = array()) {
         return vsprintf($text, $parameters);
     }));
     $this->defaults = $this->getMockBuilder('\\OC_Defaults')->disableOriginalConstructor()->getMock();
     $this->userManager = $this->getMockBuilder('\\OCP\\IUserManager')->disableOriginalConstructor()->getMock();
     $this->urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->mailer = $this->getMockBuilder('\\OCP\\Mail\\IMailer')->disableOriginalConstructor()->getMock();
     $this->secureRandom = $this->getMockBuilder('\\OCP\\Security\\ISecureRandom')->disableOriginalConstructor()->getMock();
     $this->timeFactory = $this->getMockBuilder('\\OCP\\AppFramework\\Utility\\ITimeFactory')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->lostController = new LostController('Core', $this->request, $this->urlGenerator, $this->userManager, $this->defaults, $this->l10n, $this->config, $this->secureRandom, 'lostpassword-noreply@localhost', true, $this->mailer, $this->timeFactory);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:18,代码来源:LostControllerTest.php

示例9: testCreateTagConflict

 /**
  * @dataProvider nodeClassProvider
  * @expectedException \Sabre\DAV\Exception\Conflict
  */
 public function testCreateTagConflict($nodeClass)
 {
     $this->user->expects($this->once())->method('getUID')->willReturn('admin');
     $this->groupManager->expects($this->once())->method('isAdmin')->with('admin')->willReturn(true);
     $requestData = json_encode(['name' => 'Test', 'userVisible' => true, 'userAssignable' => false]);
     $node = $this->getMockBuilder($nodeClass)->disableOriginalConstructor()->getMock();
     $this->tagManager->expects($this->once())->method('createTag')->with('Test', true, false)->will($this->throwException(new TagAlreadyExistsException('Tag already exists')));
     $this->tree->expects($this->any())->method('getNodeForPath')->with('/systemtags')->will($this->returnValue($node));
     $request = $this->getMockBuilder('Sabre\\HTTP\\RequestInterface')->disableOriginalConstructor()->getMock();
     $response = $this->getMockBuilder('Sabre\\HTTP\\ResponseInterface')->disableOriginalConstructor()->getMock();
     $request->expects($this->once())->method('getPath')->will($this->returnValue('/systemtags'));
     $request->expects($this->once())->method('getBodyAsString')->will($this->returnValue($requestData));
     $request->expects($this->once())->method('getHeader')->with('Content-Type')->will($this->returnValue('application/json'));
     $this->plugin->httpPost($request, $response);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:19,代码来源:SystemTagPluginTest.php

示例10: testPrepareTwoFactorLogin

 public function testPrepareTwoFactorLogin()
 {
     $this->user->expects($this->once())->method('getUID')->will($this->returnValue('ferdinand'));
     $this->session->expects($this->once())->method('set')->with('two_factor_auth_uid', 'ferdinand');
     $this->manager->prepareTwoFactorLogin($this->user);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:6,代码来源:ManagerTest.php


注:本文中的OCP\IUser::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。