Browse Source

Again better split on tests

master
Sébastien Lucas 10 years ago
parent
commit
26437ab0c6
1 changed files with 29 additions and 1 deletions
  1. +29
    -1
      test/bookTest.php

+ 29
- 1
test/bookTest.php View File

@@ -188,11 +188,39 @@ 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 ("Strand Magazine", $book->getPublisher()->name);
}

public function testGetRating_FiveStars ()
{
$book = Book::getBookById(2);

$this->assertEquals ("&#9733;&#9733;&#9733;&#9733;&#9733;", $book->getRating ());
}

public function testGetRating_FourStars ()
{
$book = Book::getBookById(2);
$book->rating = 8;

// 4 filled stars and one empty
$this->assertEquals ("&#9733;&#9733;&#9733;&#9733;&#9734;", $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 ()


Loading…
Cancel
Save