public function testExcludedAction() { $url = '/console/group/excluded/?name=test'; $group = array('Name' => 'test'); $clients = array(array('Id' => '1', 'Name' => 'computerName', 'UserName' => 'userName', 'InventoryDate' => new \DateTime('2014-04-09 18:56:12'))); $this->_groupManager->expects($this->once())->method('getGroup')->with('test')->willReturn($group); $this->_clientManager->expects($this->once())->method('getClients')->with(array('Name', 'UserName', 'InventoryDate'), 'InventoryDate', 'desc')->willReturn($clients); $this->dispatch($url); $this->assertResponseStatusCode(200); $this->assertXpathQueryContentContains("//ul[@class='navigation navigation_details']/li[@class='active']/a[@href='{$url}']", 'Ausgeschlossen'); $this->assertXpathQuery("//p[@class='textcenter'][text()='\nAnzahl Computer: 1\n']"); $this->assertXpathQuery("//td/a[@href='/console/client/groups/?id=1'][text()='computerName']"); }
public function testDeleteActionPostYesKeepInterfacesError() { $form = $this->getApplicationServiceLocator()->get('FormElementManager')->get('Console\\Form\\DeleteClient'); $form->expects($this->never())->method('render'); $map = array(array('Name', 'name')); $client = $this->createMock('Model\\Client\\Client'); $client->method('offsetGet')->will($this->returnValueMap($map)); $this->_clientManager->method('getClient')->willReturn($client); $this->_clientManager->expects($this->once())->method('deleteClient')->with($client, false)->willThrowException(new \RuntimeException()); $postData = array('yes' => 'Yes', 'DeleteInterfaces' => '0'); $this->dispatch('/console/client/delete/?id=1', 'POST', $postData); $this->assertRedirectTo('/console/client/index/'); $flashMessenger = $this->_getControllerPlugin('FlashMessenger'); $this->assertEmpty($flashMessenger->getCurrentSuccessMessages()); $this->assertContains(array("Client '%s' could not be deleted." => 'name'), $flashMessenger->getCurrentErrorMessages()); }