Пример #1
0
 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);
 }
Пример #2
0
 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);
 }
Пример #3
0
 /**
  * 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;
 }
Пример #4
0
 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);
 }
Пример #5
0
 public function testSetAndGetPublished()
 {
     $value = new Zend_Date();
     $this->_entry->setPublished($value);
     $this->assertEquals($value, $this->_entry->getPublished());
 }
Пример #6
0
 /**
  * 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;
 }