public function testAddActionPostValid()
 {
     $postData = array('key' => 'value');
     $this->_addToGroupForm->expects($this->once())->method('setData')->with($postData);
     $this->_addToGroupForm->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->_addToGroupForm->expects($this->once())->method('process')->with('filter', 'search', 'operator', 'invert')->will($this->returnValue(array('Name' => 'test')));
     $this->_addToGroupForm->expects($this->never())->method('render');
     $this->dispatch('/console/group/add?filter=filter&search=search&invert=invert&operator=operator', 'POST', $postData);
     $this->assertRedirectTo('/console/group/members/?name=test');
 }
 /**
  * Use Form to set query or include/exclude computers
  *
  * @return array|\Zend\Http\Response array(form) or redirect response
  */
 public function addAction()
 {
     if ($this->getRequest()->isPost()) {
         $this->_addToGroupForm->setData($this->params()->fromPost());
         if ($this->_addToGroupForm->isValid()) {
             $group = $this->_addToGroupForm->process($this->params()->fromQuery('filter'), $this->params()->fromQuery('search'), $this->params()->fromQuery('operator'), $this->params()->fromQuery('invert'));
             return $this->redirectToRoute('group', 'members', array('name' => $group['Name']));
         }
     }
     return array('form' => $this->_addToGroupForm);
 }