public function setUp() { include APPLICATION_PATH . '/../scripts/load.sqlite.php'; $now = new Zend_Date(); $this->_testEntry = new Postr_Model_Entry(); $this->_testEntry->setTitle('Test Entry')->setContent('Test entry with' . PHP_EOL . 'multiple lines.')->setSummary('Test entry summary.')->setUpdated($now)->setPublished($now); $this->_entryMapper = new Postr_Model_EntryMapper(); parent::setUp(); }
public function setUp() { include APPLICATION_PATH . '/../scripts/load.sqlite.php'; $this->bootstrap = APPLICATION_PATH . '/../tests/application/bootstrap.php'; $now = new Zend_Date(); $this->_testEntry = new Postr_Model_Entry(); $this->_testEntry->setTitle('Test Entry')->setContent('Test entry content.')->setSummary('Test entry summary.')->setUpdated($now)->setPublished($now); $this->_entryMapper = new Postr_Model_EntryMapper(); parent::setUp(); }
/** * 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 testSetAndGetTitle() { $value = 'Test Entry'; $this->_entry->setTitle($value); $this->assertEquals($value, $this->_entry->getTitle()); }