Add new tests. re #96
這個提交存在於:
父節點
934c8012ab
當前提交
0de883de67
共有 1 個檔案被更改,包括 37 行新增 和 0 行删除
|
@ -59,5 +59,42 @@ class StackTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals (8, count($entryArray));
|
||||
$this->assertEquals (-1, $totalNumber);
|
||||
}
|
||||
|
||||
public function testGetBooksBySeries ()
|
||||
{
|
||||
// All book from the Sherlock Holmes series
|
||||
list ($entryArray, $totalNumber) = Book::getBooksBySeries (1, -1);
|
||||
$this->assertEquals (7, count($entryArray));
|
||||
$this->assertEquals (-1, $totalNumber);
|
||||
}
|
||||
|
||||
public function testGetBooksByTag ()
|
||||
{
|
||||
// All book with the Fiction tag
|
||||
list ($entryArray, $totalNumber) = Book::getBooksByTag (1, -1);
|
||||
$this->assertEquals (14, count($entryArray));
|
||||
$this->assertEquals (-1, $totalNumber);
|
||||
}
|
||||
|
||||
public function testGetBooksByLanguage ()
|
||||
{
|
||||
// All english book (= all books)
|
||||
list ($entryArray, $totalNumber) = Book::getBooksByLanguage (1, -1);
|
||||
$this->assertEquals (14, count($entryArray));
|
||||
$this->assertEquals (-1, $totalNumber);
|
||||
}
|
||||
|
||||
public function testGetBookById ()
|
||||
{
|
||||
// also check most of book's class methods
|
||||
$book = Book::getBookById(2);
|
||||
$this->assertEquals ("The Return of Sherlock Holmes", $book->getTitle ());
|
||||
$this->assertEquals ("urn:uuid:87ddbdeb-1e27-4d06-b79b-4b2a3bfc6a5f", $book->getEntryId ());
|
||||
$this->assertEquals ("index.php?page=13&id=2", $book->getDetailUrl ());
|
||||
$this->assertEquals ("Doyle, Arthur Conan", $book->getAuthorsName ());
|
||||
$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 & 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));
|
||||
|
||||
}
|
||||
|
||||
}
|
載入中…
新增表格
Add a link
新增問題並參考