Add some new tests. re #96

This commit is contained in:
Sébastien Lucas 2013-10-04 12:19:34 +02:00
parent 0de883de67
commit 3be4fce3a5

View file

@ -84,6 +84,13 @@ class StackTest extends PHPUnit_Framework_TestCase
$this->assertEquals (-1, $totalNumber); $this->assertEquals (-1, $totalNumber);
} }
public function testGetAllBooks ()
{
// All books by first letter
$entryArray = Book::getAllBooks (1, -1);
$this->assertCount (9, $entryArray);
}
public function testGetBookById () public function testGetBookById ()
{ {
// also check most of book's class methods // also check most of book's class methods
@ -94,7 +101,8 @@ class StackTest extends PHPUnit_Framework_TestCase
$this->assertEquals ("Doyle, Arthur Conan", $book->getAuthorsName ()); $this->assertEquals ("Doyle, Arthur Conan", $book->getAuthorsName ());
$this->assertEquals ("Fiction, Mystery & Detective, Short Stories", $book->getTagsName ()); $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 19011902 (although setting it before Holmes\' death) Doyle came under intense pressure to revive his famous character.</p>', $book->getComment (false)); $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 19011902 (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 ());
} }
} }