public function testValidateInvalidIpV6() { $form = new Admin_Form_IpRange(); $postData = array('name' => 'ValidIpTest', 'startingip' => '2001:0db8:85a3:0000:0000:8a2e:0370:7334', 'endingip' => '2001:0db8:85a3:0000:0000:8a2e:0370:7334'); $this->assertFalse($form->isValid($postData)); $errors = $form->getElement('startingip')->getErrors(); $this->assertFalse(empty($errors)); $this->assertTrue($errors[0] === 'notIpAddress'); $errors = $form->getElement('endingip')->getErrors(); $this->assertFalse(empty($errors)); $this->assertTrue($errors[0] === 'notIpAddress'); }
/** * Updates an IP range. */ public function updateAction() { $form = new Admin_Form_IpRange(); if ($this->getRequest()->isPost()) { $postData = $this->getRequest()->getPost(); $button = $this->getRequest()->getPost('cancel'); if (isset($button)) { $this->_helper->redirector('index'); return; } $id = $this->getRequest()->getParam('id'); if ($form->isValid($postData)) { $this->_updateIpRange($postData, $id); } else { $actionUrl = $this->view->url(array('action' => 'update', 'id' => $id)); $form->setAction($actionUrl); $this->view->form = $form; $this->view->title = 'admin_iprange_edit'; return $this->renderScript('iprange/edit.phtml'); } } $this->_helper->redirector('index'); }