/** * item still in database? * * @return boolean true if item is already in database * @param mixed the current item */ protected function itemExists($item) { $itemsModel = new application_models_items(); $res = $itemsModel->fetchAll($itemsModel->select()->from($itemsModel, array('amount' => 'Count(*)'))->where('uid="' . $item->getId() . '"')); if ($res[0]['amount'] > 0) { Zend_Registry::get('logger')->log('item "' . $item->getTitle() . '" already fetched', Zend_Log::DEBUG); return true; } return false; }
/** * test remove a feed */ public function testRemove() { $this->model->remove(3); // feed really deleted $this->assertEquals(0, $this->model->find(3)->count()); // all items deleted $itemModel = new application_models_items(); $result = $itemModel->fetchAll($itemModel->select()->where('feed=?', 3)); $this->assertEquals(0, $result->count()); // no icon file $this->assertFalse(file_exists(Zend_Registry::get('config')->favicons->path . "4711.ico")); // no messages $messagesModel = new application_models_messages(); $result = $messagesModel->fetchAll($messagesModel->select()->where('feed=?', 3)); $this->assertEquals(0, $result->count()); // check reorder $this->assertEquals('0', $this->model->find('1')->current()->position); // correct position $this->assertEquals('1', $this->model->find('2')->current()->position); // correct position // validation $this->assertTrue($this->model->remove(222) !== true); }