From 26437ab0c6351d63742cd5596d458783997b8e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 4 Jun 2014 21:31:27 +0200 Subject: [PATCH] Again better split on tests --- test/bookTest.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/bookTest.php b/test/bookTest.php index afdc5e0..5fb5a37 100644 --- a/test/bookTest.php +++ b/test/bookTest.php @@ -188,11 +188,39 @@ class BookTest extends PHPUnit_Framework_TestCase $this->assertEquals ("Fiction, Mystery & Detective, Short Stories", $book->getTagsName ()); $this->assertEquals ('

The Return of Sherlock Holmes is a collection of 13 Sherlock Holmes stories, originally published in 1903-1904, by Arthur Conan Doyle.
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 & Co. added another 28,000 to the run.
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.

', $book->getComment (false)); $this->assertEquals ("English", $book->getLanguages ()); + $this->assertEquals ("Strand Magazine", $book->getPublisher()->name); + } + + public function testGetRating_FiveStars () + { + $book = Book::getBookById(2); + $this->assertEquals ("★★★★★", $book->getRating ()); + } + + public function testGetRating_FourStars () + { + $book = Book::getBookById(2); $book->rating = 8; + // 4 filled stars and one empty $this->assertEquals ("★★★★☆", $book->getRating ()); - $this->assertEquals ("Strand Magazine", $book->getPublisher()->name); + } + + public function testGetRating_NoStars_Zero () + { + $book = Book::getBookById(2); + $book->rating = 0; + + $this->assertEquals ("", $book->getRating ()); + } + + public function testGetRating_NoStars_Null () + { + $book = Book::getBookById(2); + $book->rating = NULL; + + $this->assertEquals ("", $book->getRating ()); } public function testBookGetLinkArrayWithUrlRewriting ()