本文整理汇总了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);
}