public function testAllowActionPostYes() { $this->_duplicates->expects($this->once())->method('allow')->with('Serial', '12345678'); $this->dispatch('/console/duplicates/allow/?criteria=Serial&value=12345678', 'POST', array('yes' => 'Yes')); $this->assertRedirectTo('/console/duplicates/index/'); $this->assertContains(array("'%s' is no longer considered duplicate." => '12345678'), $this->_getControllerPlugin('FlashMessenger')->getCurrentSuccessMessages()); }
/** * Allow given criteria and value as duplicate * * @return array|Zend\Http\Response criteria/value for GET, redirect response for POST */ public function allowAction() { $params = $this->params(); $criteria = $params->fromQuery('criteria'); $value = $params->fromQuery('value'); if ($this->getRequest()->isPost()) { if ($params->fromPost('yes')) { $this->_duplicates->allow($criteria, $value); $this->flashMessenger()->addSuccessMessage(array($this->_("'%s' is no longer considered duplicate.") => $value)); return $this->redirectToRoute('duplicates', 'index'); } else { // Operation cancelled by user return $this->redirectToRoute('duplicates', 'manage', array('criteria' => $criteria)); } } else { // View script renders form return array('criteria' => $criteria, 'value' => $value); } }