public function testDeletedEntryIsNull() { $this->_entryMapper->postEntry($this->_testEntry); $entry = $this->_entryMapper->getEntry($this->_testEntry->getId()); $this->_entryMapper->deleteEntry($entry); $deletedEntry = $this->_entryMapper->getEntry($entry->getId()); $this->assertNull($deletedEntry); }
public function testDeleteActionEntryIsDeleted() { $this->_entryMapper->postEntry($this->_testEntry); $this->dispatch('/entry/delete/id/' . $this->_testEntry->getId()); $id = $this->getRequest()->getParam('id'); $deletedEntry = $this->_entryMapper->getEntry($id); $this->assertNull($deletedEntry); }
/** * Post Action * * @return void */ public function postAction() { $entryForm = new Postr_Form_Entry(); $this->view->headTitle()->prepend('Post'); 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 = new Postr_Model_Entry(); $entry->setTitle($title)->setContent($content)->setSummary($summary)->setUpdated($updated)->setPublished($published); $this->_entryMapper->postEntry($entry); $this->_setParam('id', $entry->getId()); $this->_redirect($this->_router->assemble(array('action' => 'get', 'controller' => 'entry', 'id' => $entry->getId()), null, true)); } $entryForm->setMethod('post')->setAction($this->_router->assemble(array('action' => 'post', 'controller' => 'entry'), null, true)); $this->view->entryForm = $entryForm; }