**2012-11-22**
**Added global support for publishers** Files modified: *base.php* - changed class Entry, - adding a constant ```cops:publishers``` to the icon array for the feed. - changed class Page - added branches to the page selector switch - changed Page->public function InitializeContent - added call to pull publisher count from database - changed class PageAllBooks - changed it so ```getCurrentOption``` is actually used... - added page descendant class ```PageAllPublishers``` - handles pulling the publishers category from database - added page descendant class ```PagePublisherDetail``` - handles pulling the books per publisher data from database - changed class PageQueryResult - added constant and switches for publisher search scope - abstract class Base - added constants for the publisher pages *book.php* - added require statement for publisher.php - added ```SQL_BOOKS_BY_PUBLISHER``` query to retrieve books by publisher. - changed class Book - added query constant - added publisher item - added test in case no known publisher - added publishername and url array elements for the JSON output - added public function ```getPublisher``` - added public static function ```getBooksByPublisher``` to fire the query - changed function getJson - added publisher category to search - added publishername (single) and publishertitle(plural) localization entries to i18n translation array *index.php* - added require statement for publisher.php *lang/Localization_en.json - added new localization entries for publisher labels (see below) ``` "publisher.alphabetical.many":"Alphabetical index of the {0} publishers", "publisher.alphabetical.none":"Alphabetical index of absolutely no publisher", "publisher.alphabetical.one":"Alphabetical index of the single publisher", "publisher.name":"Publisher", "publisher.title":"Publishers", "publisherword.many":"{0} publishers", "publisherword.none":"No publisher", "publisherword.one":"1 publisher", "search.result.publisher":"Search result for *{0}* in publishers", ``` *templates\bookdetail.html* - added publisher label and item to bookdetail popup *test\bookTest.php* - added indices and names of publishers added to testdatabase as comment - added test function ```testGetBooksByPublisher``` - changed test function testGetBookById to add assertion for publisher name - changed test function testTypeaheadSearch to add search on partial publisher name. *test\pageTest.php* - changed test function testPageIndex to insert publisher category and adjust page indices - changed test function testPageIndexWithCustomColum to adjust for the changed page indices - added test function testPageAllPublishers - added test function testPagePublishersDetail - added test function testPageSearchScopePublishers *test\BaseWithSomeBooks\metadata.db* - added 5 publishers spread across all 14 books, replacing the original publisher Feedbooks Files added: *publisher.php*
This commit is contained in:
parent
9d4e358738
commit
9efcd661a0
9 changed files with 296 additions and 28 deletions
|
@ -9,6 +9,15 @@
|
|||
require_once (dirname(__FILE__) . "/config_test.php");
|
||||
require_once (dirname(__FILE__) . "/../book.php");
|
||||
|
||||
/*
|
||||
Publishers:
|
||||
id:2 (2 books) Macmillan and Co. London: Lewis Caroll
|
||||
id:3 (2 books) D. Appleton and Company Alexander Dumas
|
||||
id:4 (1 book) Macmillan Publishers USA: Jack London
|
||||
id:5 (1 book) Pierson's Magazine: H. G. Wells
|
||||
id:6 (8 books) Strand Magazine: Arthur Conan Doyle
|
||||
*/
|
||||
|
||||
class BookTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetBookCount ()
|
||||
|
@ -74,6 +83,14 @@ class BookTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals (-1, $totalNumber);
|
||||
}
|
||||
|
||||
public function testGetBooksByPublisher ()
|
||||
{
|
||||
// All books from Strand Magazine
|
||||
list ($entryArray, $totalNumber) = Book::getBooksByPublisher (6, -1);
|
||||
$this->assertEquals (8, count($entryArray));
|
||||
$this->assertEquals (-1, $totalNumber);
|
||||
}
|
||||
|
||||
public function testGetBooksByTag ()
|
||||
{
|
||||
// All book with the Fiction tag
|
||||
|
@ -132,6 +149,7 @@ class BookTest extends PHPUnit_Framework_TestCase
|
|||
$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));
|
||||
$this->assertEquals ("English", $book->getLanguages ());
|
||||
$this->assertEquals ("", $book->getRating ());
|
||||
$this->assertEquals ("Strand Magazine", $book->getPublisher()->name);
|
||||
}
|
||||
|
||||
public function testTypeaheadSearch ()
|
||||
|
@ -167,6 +185,16 @@ class BookTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals ("Doyle, Arthur Conan", $array[1]["title"]);
|
||||
$this->assertEquals ("1 series", $array[2]["title"]);
|
||||
$this->assertEquals ("D'Artagnan Romances", $array[3]["title"]);
|
||||
|
||||
$_GET["query"] = "Macmillan";
|
||||
$_GET["search"] = "1";
|
||||
|
||||
$array = getJson ();
|
||||
|
||||
$this->assertCount (3, $array);
|
||||
$this->assertEquals ("2 publishers", $array[0]["title"]);
|
||||
$this->assertEquals ("Macmillan and Co. London", $array[1]["title"]);
|
||||
$this->assertEquals ("Macmillan Publishers USA", $array[2]["title"]);
|
||||
|
||||
$_GET["query"] = NULL;
|
||||
$_GET["search"] = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue