當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。