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


PHP IConfig::method方法代码示例

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


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

示例1: testGetShareByTokenPublicSharingDisabled

 public function testGetShareByTokenPublicSharingDisabled()
 {
     $share = $this->manager->newShare();
     $share->setShareType(\OCP\Share::SHARE_TYPE_LINK)->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
     $this->config->method('getAppValue')->will($this->returnValueMap([['core', 'shareapi_allow_public_upload', 'yes', 'no']]));
     $this->defaultProvider->expects($this->once())->method('getShareByToken')->willReturn('validToken')->willReturn($share);
     $res = $this->manager->getShareByToken('validToken');
     $this->assertSame(\OCP\Constants::PERMISSION_READ, $res->getPermissions());
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:9,代码来源:ManagerTest.php

示例2: testCanShare

 /**
  * @dataProvider dataCanShare
  *
  * @param bool $expected
  * @param string $sharingEnabled
  * @param bool $disabledForUser
  */
 public function testCanShare($expected, $sharingEnabled, $disabledForUser)
 {
     $this->config->method('getAppValue')->will($this->returnValueMap([['core', 'shareapi_enabled', 'yes', $sharingEnabled]]));
     $manager = $this->createManagerMock()->setMethods(['sharingDisabledForUser'])->getMock();
     $manager->method('sharingDisabledForUser')->willReturn($disabledForUser);
     $user = $this->getMock('\\OCP\\IUser');
     $share = $this->manager->newShare();
     $share->setSharedBy($user);
     $res = $this->invokePrivate($manager, 'canShare', [$share]);
     $this->assertEquals($expected, $res);
 }
开发者ID:podemos-info,项目名称:owncloud-core,代码行数:18,代码来源:managertest.php

示例3: testCanShare

 /**
  * @dataProvider dataCanShare
  *
  * @param bool $expected
  * @param string $sharingEnabled
  * @param bool $disabledForUser
  */
 public function testCanShare($expected, $sharingEnabled, $disabledForUser)
 {
     $this->config->method('getAppValue')->will($this->returnValueMap([['core', 'shareapi_enabled', 'yes', $sharingEnabled]]));
     $manager = $this->getMockBuilder('\\OC\\Share20\\Manager')->setConstructorArgs([$this->logger, $this->config, $this->defaultProvider, $this->secureRandom, $this->hasher, $this->mountManager, $this->groupManager, $this->l])->setMethods(['isSharingDisabledForUser'])->getMock();
     $manager->method('isSharingDisabledForUser')->willReturn($disabledForUser);
     $user = $this->getMock('\\OCP\\IUser');
     $share = new \OC\Share20\Share();
     $share->setSharedBy($user);
     $res = $this->invokePrivate($manager, 'canShare', [$share]);
     $this->assertEquals($expected, $res);
 }
开发者ID:gcstang,项目名称:core,代码行数:18,代码来源:managertest.php

示例4: testBeforeControllerWithExternalShareControllerWithSharingEnabled

 /**
  * @dataProvider externalSharesChecksDataProvider
  */
 public function testBeforeControllerWithExternalShareControllerWithSharingEnabled($annotations, $config, $noException)
 {
     $this->appManager->expects($this->once())->method('isEnabledForUser')->with('files_sharing')->will($this->returnValue(true));
     $this->reflector->expects($this->atLeastOnce())->method('hasAnnotation')->will($this->returnValueMap($annotations));
     $this->config->method('getAppValue')->will($this->returnValueMap($config));
     $controller = $this->getMockBuilder('\\OCA\\Files_Sharing\\Controllers\\ExternalSharesController')->disableOriginalConstructor()->getMock();
     $exceptionThrown = false;
     try {
         $this->sharingCheckMiddleware->beforeController($controller, 'myMethod');
     } catch (\OCA\Files_Sharing\Exceptions\S2SException $exception) {
         $exceptionThrown = true;
     }
     $this->assertNotEquals($noException, $exceptionThrown);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:17,代码来源:SharingCheckMiddlewareTest.php

示例5: testCanShare

 /**
  * @dataProvider dataCanShare
  *
  * @param bool $expected
  * @param string $sharingEnabled
  * @param bool $disabledForUser
  */
 public function testCanShare($expected, $sharingEnabled, $disabledForUser)
 {
     $this->config->method('getAppValue')->will($this->returnValueMap([['core', 'shareapi_enabled', 'yes', $sharingEnabled]]));
     $manager = $this->createManagerMock()->setMethods(['sharingDisabledForUser'])->getMock();
     $manager->method('sharingDisabledForUser')->with('user')->willReturn($disabledForUser);
     $share = $this->manager->newShare();
     $share->setSharedBy('user');
     $exception = false;
     try {
         $res = $this->invokePrivate($manager, 'canShare', [$share]);
     } catch (\Exception $e) {
         $exception = true;
     }
     $this->assertEquals($expected, !$exception);
 }
开发者ID:gvde,项目名称:core,代码行数:22,代码来源:managertest.php


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