Exemplo n.º 1
0
 public function testGetWindowsState()
 {
     $user = new User();
     $windowStateId = 42;
     $windowState = $this->createWindowState(['cleanUrl' => 'foo']);
     $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
     $token->expects($this->once())->method('getUser')->willReturn($user);
     $this->tokenStorage->expects($this->once())->method('getToken')->willReturn($token);
     $repo = $this->getMockBuilder('Oro\\Bundle\\WindowsBundle\\Entity\\Repository\\WindowsStateRepository')->disableOriginalConstructor()->getMock();
     $this->doctrineHelper->expects($this->once())->method('getEntityRepository')->willReturn($repo);
     $repo->expects($this->once())->method('findBy')->with(['user' => $user, 'id' => $windowStateId])->willReturn($windowState);
     $this->requestStateManager->expects($this->never())->method($this->anything());
     $this->assertSame($windowState, $this->manager->getWindowsState($windowStateId));
 }