public function _getYears() { $mapper = new Model_Mapper_Post(); $years = $mapper->fetchValidYears(); $array[0] = 'All Years'; for ($year = $years['min_year']; $year <= $years['max_year']; $year++) { $array[$year] = $year; } return $array; }
public function getRecentPosts($limit) { $cache_id = 'recent_posts'; if (!($data = $this->_cache->load($cache_id))) { $data = parent::getRecentPosts($limit); $this->_cache->save($data, $cache_id, array('post')); } return $data; }
public function testCreatePost() { $this->dispatch('/admin/create-post/'); $this->assertController('error'); $this->assertAction('error'); $this->_login(); $this->dispatch('/admin/create-post/'); $this->assertController('admin'); $this->assertAction('create-post'); $this->request->setMethod('POST')->setPost(array('title' => 'Test!!!!!!!!' . time(), 'content' => 'The test content.', 'category_id' => '5', 'new_category' => '', 'is_published' => 1)); $this->dispatch('/admin/create-post/'); //echo $this->getResponse()->getBody(false); $this->assertController('admin'); $this->assertAction('create-post'); $mapper = new Model_Mapper_Post(); $post = $mapper->fetchLatest(); $mapper->delete($post); $this->_logout(); }