public function testSubmitElementHasCorrectLabel() { $element = $this->_entryForm->getElement('submit'); $this->assertEquals('Submit', $element->getLabel()); }
/** * Put Action * * @return void */ public function putAction() { $id = $this->_getParam('id'); $this->view->headTitle()->prepend('Put'); $entry = $this->_entryMapper->getEntry($id); if (null === $entry) { throw new Zend_Controller_Dispatcher_Exception(); } $entryForm = new Postr_Form_Entry(); if ($entryForm->isValid($this->_getAllParams())) { $title = $entryForm->getValue('title'); $content = $entryForm->getValue('entry_content'); $summary = $entryForm->getValue('entry_summary'); $updated = new Zend_Date($entryForm->getValue('updated'), Zend_Date::DATETIME_SHORT); $published = new Zend_Date($entryForm->getValue('published'), Zend_Date::DATETIME_SHORT); $entry->setTitle($title)->setContent($content)->setSummary($summary)->setUpdated($updated)->setPublished($published); $this->_entryMapper->putEntry($entry); $this->_redirect($this->_router->assemble(array('action' => 'get', 'controller' => 'entry', 'id' => $entry->getId()), null, true)); } $entryForm->setMethod('post')->setAction($this->_router->assemble(array('action' => 'put', 'controller' => 'entry', 'id' => $entry->getId()), null, true)); $this->view->entryForm = $entryForm; }