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; }
public function isEqualTo(Postr_Model_Entry $entry) { return $this->getTitle() == $entry->getTitle() && $this->getContent() == $entry->getContent() && $this->getSummary() == $entry->getSummary() && $this->getUpdated()->get(Zend_Date::DATETIME_SHORT) == $entry->getUpdated()->get(Zend_Date::DATETIME_SHORT) && $this->getPublished()->get(Zend_Date::DATETIME_SHORT) == $entry->getPublished()->get(Zend_Date::DATETIME_SHORT); }
public function testSetAndGetPublished() { $value = new Zend_Date(); $this->_entry->setPublished($value); $this->assertEquals($value, $this->_entry->getPublished()); }
/** * Delete Entry * * @param Postr_Model_Entry $entry * @return Postr_Model_EntryMapper Provides a fluent interface */ public function deleteEntry(Postr_Model_Entry $entry) { $dbAdapter = $this->_entryTable->getAdapter(); $dbAdapter->beginTransaction(); $entryRow = $this->_entryTable->find($entry->getId())->current(); $entryRow->delete(); $dbAdapter->commit(); return $this; }