public function testUpdateWindowState() { $windowId = 42; $user = new User(); $data = ['url' => '/test']; $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); $this->requestStateManager->expects($this->once())->method('getData')->willReturn($data); $repo->expects($this->once())->method('update')->with($user, $windowId, $data); $this->manager->updateWindowsState($windowId); }