Update test of ratings. re #137

Esse commit está contido em:
Sébastien Lucas 2014-03-10 14:02:00 +01:00
commit c1c467ac87
3 arquivos alterados com 34 adições e 2 exclusões

Arquivo binário não exibido.

Ver arquivo

@ -188,7 +188,7 @@ class BookTest extends PHPUnit_Framework_TestCase
$this->assertEquals ("Fiction, Mystery & Detective, Short Stories", $book->getTagsName ());
$this->assertEquals ('<p class="description">The Return of Sherlock Holmes is a collection of 13 Sherlock Holmes stories, originally published in 1903-1904, by Arthur Conan Doyle.<br />The book was first published on March 7, 1905 by Georges Newnes, Ltd and in a Colonial edition by Longmans. 30,000 copies were made of the initial print run. The US edition by McClure, Phillips &amp; Co. added another 28,000 to the run.<br />This was the first Holmes collection since 1893, when Holmes had "died" in "The Adventure of the Final Problem". Having published The Hound of the Baskervilles in 1901–1902 (although setting it before Holmes\' death) Doyle came under intense pressure to revive his famous character.</p>', $book->getComment (false));
$this->assertEquals ("English", $book->getLanguages ());
$this->assertEquals ("", $book->getRating ());
$this->assertEquals ("&#9733;&#9733;&#9733;&#9733;&#9733;", $book->getRating ());
$book->rating = 8;
// 4 filled stars and one empty
$this->assertEquals ("&#9733;&#9733;&#9733;&#9733;&#9734;", $book->getRating ());

Ver arquivo

@ -33,7 +33,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$this->assertEquals ("Tags", $currentPage->entryArray [3]->title);
$this->assertEquals ("Alphabetical index of the 10 tags", $currentPage->entryArray [3]->content);
$this->assertEquals ("Rating", $currentPage->entryArray [4]->title);
$this->assertEquals ("no ratings", $currentPage->entryArray [4]->content);
$this->assertEquals ("3 different ratings", $currentPage->entryArray [4]->content);
$this->assertEquals ("Languages", $currentPage->entryArray [5]->title);
$this->assertEquals ("Alphabetical index of the single language", $currentPage->entryArray [5]->content);
$this->assertEquals ("All books", $currentPage->entryArray [6]->title);
@ -462,6 +462,38 @@ class PageTest extends PHPUnit_Framework_TestCase
$this->assertTrue ($currentPage->ContainsBook ());
}
public function testPageAllRatings ()
{
$page = Base::PAGE_ALL_RATINGS;
$query = NULL;
$qid = NULL;
$n = "1";
$currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent ();
$this->assertEquals ("Rating", $currentPage->title);
$this->assertCount (3, $currentPage->entryArray);
$this->assertEquals ("2 stars", $currentPage->entryArray [0]->title);
$this->assertFalse ($currentPage->ContainsBook ());
}
public function testPageRatingDetail ()
{
$page = Base::PAGE_RATING_DETAIL;
$query = NULL;
$qid = "1";
$n = "1";
$currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent ();
$this->assertEquals ("5 stars", $currentPage->title);
$this->assertCount (4, $currentPage->entryArray);
$this->assertEquals ("The Adventures of Sherlock Holmes", $currentPage->entryArray [0]->title);
$this->assertTrue ($currentPage->ContainsBook ());
}
public function testPageRecent ()
{
$page = Base::PAGE_ALL_RECENT_BOOKS;