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