/** * Delete account * * @return array|\Zend\Http\Response Array (id) or redirect response */ public function deleteAction() { $id = $this->params()->fromQuery('id'); if ($this->getRequest()->isPost()) { if ($this->params()->fromPost('yes')) { $this->_operatorManager->deleteOperator($id); } return $this->redirectToRoute('accounts', 'index'); } else { $this->setActiveMenu('Preferences', 'Users'); return array('id' => $id); } }
public function testDeleteActionPostYes() { $this->_operatorManager->expects($this->once())->method('deleteOperator')->with('testId'); $this->dispatch('/console/accounts/delete/?id=testId', 'POST', array('yes' => 'Yes')); $this->assertRedirectTo('/console/accounts/index/'); }