public function testXmlSortOrder() { $firstDoc = $this->createTestDocument(); $firstDoc->setPublishedYear(9999); $firstDoc->setServerState('published'); $firstDocId = $firstDoc->store(); $secondDoc = $this->createTestDocument(); $secondDoc->setPublishedYear(9998); $secondDoc->setServerState('published'); $secondDocId = $secondDoc->store(); $forthDoc = $this->createTestDocument(); $forthDoc->setPublishedYear(9996); $forthDoc->setServerState('published'); $forthDocId = $forthDoc->store(); $thirdDoc = $this->createTestDocument(); $thirdDoc->setPublishedYear(9997); $thirdDoc->setServerState('published'); $thirdDocId = $thirdDoc->store(); // Dokument aus dem Cache löschen $documentCacheTable = new Opus_Db_DocumentXmlCache(); $documentCacheTable->delete('document_id = ' . $secondDocId); $documentCacheTable->delete('document_id = ' . $firstDocId); $this->getRequest()->setMethod('POST')->setPost(array('searchtype' => 'all', 'sortfield' => 'year', 'sortorder' => 'desc', 'rows' => '10')); $this->plugin->prepareXml(); $xpath = new DOMXPath($this->plugin->getXml()); $result = $xpath->query('//Opus_Document'); $this->assertEquals(10, $result->length); $this->assertEquals($firstDocId, $result->item(0)->attributes->item(0)->nodeValue); $this->assertEquals($secondDocId, $result->item(1)->attributes->item(0)->nodeValue); $this->assertEquals($thirdDocId, $result->item(2)->attributes->item(0)->nodeValue); $this->assertEquals($forthDocId, $result->item(3)->attributes->item(0)->nodeValue); }
/** * Removes a all cache entries matching given constraint. * * @param Zend_Db_Select $select Select statement to use as subselect * The statement MUST return a list of document ids * @return void */ public function removeAllEntriesWhereSubSelect($select) { $where = 'document_id IN (' . $select->assemble() . ')'; $this->_table->delete($where); }