本文整理汇总了PHP中Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::method方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthorizationCheckerInterface::method方法的具体用法?PHP AuthorizationCheckerInterface::method怎么用?PHP AuthorizationCheckerInterface::method使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
的用法示例。
在下文中一共展示了AuthorizationCheckerInterface::method方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRenderContentEditable
/**
* @dataProvider getRenderContentEditableTestData
*
* @param string $expectedText
* @param string $text
* @param string $name
* @param array $options
* @param bool $isAuthorized
* @param string $message
*/
public function testRenderContentEditable($expectedText, $text, $name, $options, $isAuthorized, $message)
{
$content = new Content();
$content->setId(1)->setName($name)->setText($text)->setLocale($options['locale']);
$this->manager->method('get')->with($name, $options['locale'], $text)->willReturn($content);
$this->authorizationChecker->method('isGranted')->with('ROLE_ADMIN')->willReturn($isAuthorized);
$this->editor->method('renderContent')->with($content, $options)->willReturn(sprintf('editable_%s', $text));
$rendered = $this->extension->render($text, $name, $options);
$this->assertSame($expectedText, $rendered, $message);
}
示例2: testCustomEditorInjectionIsPossible
public function testCustomEditorInjectionIsPossible()
{
$this->authorizationChecker->method('isGranted')->with('ROLE_ADMIN')->willReturn(true);
$request = new Request();
$response = new Response('<body></body>', 200, ['Content-Type' => 'text/html']);
$this->event->method('getRequest')->willReturn($request);
$this->event->method('getResponse')->willReturn($response);
$this->event->method('isMasterRequest')->willReturn(true);
$this->editor->expects($this->once())->method('renderEditor')->with($response)->willReturn(null);
$this->listener->onKernelResponse($this->event);
}
示例3: setAuthorized
/**
* @param bool $authorized
*/
private function setAuthorized($authorized)
{
$this->authorizationChecker->method('isGranted')->with('ROLE_ADMIN')->willReturn($authorized);
}