public function testPropertiesActionMissingParams() { $this->_subnetManager = $this->getMockBuilder('Model\\Network\\SubnetManager')->disableOriginalConstructor()->getMock(); $this->_subnetManager->expects($this->once())->method('getSubnet')->with(null, null)->will($this->throwException(new \InvalidArgumentException())); $this->dispatch('/console/network/properties'); $this->assertApplicationException('InvalidArgumentException'); }
/** * Edit a subnet's properties * * Query params: subnet, mask * * @return array|\Zend\Http\Response array(subnet, form) or redirect response */ public function propertiesAction() { $params = $this->params(); $subnet = $this->_subnetManager->getSubnet($params->fromQuery('subnet'), $params->fromQuery('mask')); if ($this->getRequest()->isPost()) { $this->_subnetForm->setData($params->fromPost()); if ($this->_subnetForm->isValid()) { $data = $this->_subnetForm->getData(); $this->_subnetManager->saveSubnet($subnet['Address'], $subnet['Mask'], $data['Name']); return $this->redirectToRoute('network', 'index'); } } else { $this->_subnetForm->setData(array('Name' => $subnet['Name'])); } return array('subnet' => $subnet, 'form' => $this->_subnetForm); }
public function testPropertiesActionMissingParams() { $this->_subnetManager->expects($this->once())->method('getSubnet')->with(null, null)->will($this->throwException(new \InvalidArgumentException())); $this->dispatch('/console/network/properties'); $this->assertApplicationException('InvalidArgumentException'); }