Beispiel #1
0
 /**
  * @covers PubObjectCache
  */
 public function testAddSeveralGalleys()
 {
     $nullVar = null;
     $cache = new PubObjectCache();
     $article = new PublishedArticle();
     $article->setId('2');
     $article->setIssueId('1');
     $articleGalley1 = new ArticleGalley();
     $articleGalley1->setId('3');
     $articleGalley1->setSubmissionId($article->getId());
     $articleGalley2 = new ArticleGalley();
     $articleGalley2->setId('4');
     $articleGalley2->setSubmissionId($article->getId());
     // Add galleys in the wrong order.
     $cache->add($articleGalley2, $article);
     $cache->add($articleGalley1, $article);
     $cache->markComplete('galleysByArticle', $article->getId());
     // Retrieve them in the right order.
     $retrievedGalleys = $cache->get('galleysByArticle', $article->getId());
     $expectedGalleys = array(3 => $articleGalley1, 4 => $articleGalley2);
     self::assertEquals($expectedGalleys, $retrievedGalleys);
     // And they should still be cached.
     self::assertTrue($cache->isCached('galleysByArticle', $article->getId()));
 }
Beispiel #2
0
 /**
  * Internal function to return an ArticleGalley object from a row.
  * @param $row array
  * @return ArticleGalley
  */
 function &_returnGalleyFromRow($row)
 {
     $galley = new ArticleGalley();
     $galley->setId($row['galley_id']);
     $galley->setSubmissionId($row['submission_id']);
     $galley->setLocale($row['locale']);
     $galley->setLabel($row['label']);
     $galley->setSequence($row['seq']);
     $galley->setRemoteURL($row['remote_url']);
     $galley->setIsAvailable($row['is_available']);
     $galley->setGalleyType($row['galley_type']);
     $this->getDataObjectSettings('submission_galley_settings', 'galley_id', $row['galley_id'], $galley);
     HookRegistry::call('ArticleGalleyDAO::_returnGalleyFromRow', array(&$galley, &$row));
     return $galley;
 }