public function testGetManager() { /** @var \PHPUnit_Framework_MockObject_MockObject|WindowsStateManager $manager */ $manager = $this->getMockBuilder('Oro\\Bundle\\WindowsBundle\\Manager\\WindowsStateManager')->disableOriginalConstructor()->getMock(); $this->registry->addManager($manager); $this->defaultManager->expects($this->never())->method($this->anything()); $manager->expects($this->exactly(2))->method('isApplicable')->willReturn(true); $this->assertTrue($this->registry->getManager()->isApplicable()); }
public function testIsApplicable() { $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface'); $token->expects($this->once())->method('getUser')->willReturn(new User()); $this->tokenStorage->expects($this->once())->method('getToken')->willReturn($token); $this->assertTrue($this->manager->isApplicable()); }
public function testRenderFragmentWithoutUser() { $windowState = $this->createWindowState(); $this->environment->expects($this->never())->method($this->anything()); $this->stateManager->expects($this->once())->method('deleteWindowsState')->willThrowException(new AccessDeniedException()); $this->assertEquals('', $this->extension->renderFragment($this->environment, $windowState)); $this->assertFalse($windowState->isRenderedSuccessfully()); }