cops/test/bookTest.php

549 lines
19 KiB
PHP
Raw Normal View History

2013-12-05 11:50:53 +02:00
<?php
/**
* COPS (Calibre OPDS PHP Server) test file
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Sébastien Lucas <sebastien@slucas.fr>
*/
require_once (dirname(__FILE__) . "/config_test.php");
require_once (dirname(__FILE__) . "/../book.php");
require_once (dirname(__FILE__) . "/../JSON_renderer.php");
2013-12-05 11:50:53 +02:00
/*
Publishers:
2013-12-05 11:52:51 +02:00
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
2013-12-05 11:50:53 +02:00
id:6 (8 books) Strand Magazine: Arthur Conan Doyle
*/
define ("TEST_THUMBNAIL", dirname(__FILE__) . "/thumbnail.jpg");
define ("COVER_WIDTH", 400);
define ("COVER_HEIGHT", 600);
2013-12-05 11:50:53 +02:00
class BookTest extends PHPUnit_Framework_TestCase
2013-12-05 11:52:51 +02:00
{
public static function setUpBeforeClass()
{
$book = Book::getBookById(2);
if (!is_dir ($book->path)) {
mkdir ($book->path, 0777, true);
}
$im = imagecreatetruecolor(COVER_WIDTH, COVER_HEIGHT);
$text_color = imagecolorallocate($im, 255, 0, 0);
imagestring($im, 1, 5, 5, 'Book cover', $text_color);
imagejpeg ($im, $book->path . "/cover.jpg", 80);
}
public static function tearDownAfterClass()
{
$book = Book::getBookById(2);
if (!file_exists ($book->path . "/cover.jpg")) {
return;
}
unlink ($book->path . "/cover.jpg");
rmdir ($book->path);
rmdir (dirname ($book->path));
}
2013-12-05 11:50:53 +02:00
public function testGetBookCount ()
{
$this->assertEquals (15, Book::getBookCount ());
2013-12-05 11:50:53 +02:00
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetCount ()
{
$entryArray = Book::getCount ();
$this->assertEquals (2, count($entryArray));
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$entryAllBooks = $entryArray [0];
$this->assertEquals ("Alphabetical index of the 15 books", $entryAllBooks->content);
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$entryRecentBooks = $entryArray [1];
$this->assertEquals ("50 most recent books", $entryRecentBooks->content);
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetCountRecent ()
{
global $config;
2013-12-05 11:52:51 +02:00
$config['cops_recentbooks_limit'] = 0;
2013-12-05 11:50:53 +02:00
$entryArray = Book::getCount ();
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$this->assertEquals (1, count($entryArray));
2013-12-05 11:52:51 +02:00
$config['cops_recentbooks_limit'] = 2;
2013-12-05 11:50:53 +02:00
$entryArray = Book::getCount ();
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$entryRecentBooks = $entryArray [1];
$this->assertEquals ("2 most recent books", $entryRecentBooks->content);
2013-12-05 11:52:51 +02:00
$config['cops_recentbooks_limit'] = 50;
2013-12-05 11:50:53 +02:00
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetBooksByAuthor ()
{
// All book by Arthur Conan Doyle
global $config;
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$config['cops_max_item_per_page'] = 5;
list ($entryArray, $totalNumber) = Book::getBooksByAuthor (1, 1);
$this->assertEquals (5, count($entryArray));
$this->assertEquals (8, $totalNumber);
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
list ($entryArray, $totalNumber) = Book::getBooksByAuthor (1, 2);
$this->assertEquals (3, count($entryArray));
$this->assertEquals (8, $totalNumber);
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$config['cops_max_item_per_page'] = -1;
list ($entryArray, $totalNumber) = Book::getBooksByAuthor (1, -1);
$this->assertEquals (8, count($entryArray));
$this->assertEquals (-1, $totalNumber);
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
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);
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetBooksByPublisher ()
{
2013-12-05 11:52:51 +02:00
// All books from Strand Magazine
2013-12-05 11:50:53 +02:00
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
list ($entryArray, $totalNumber) = Book::getBooksByTag (1, -1);
$this->assertEquals (14, count($entryArray));
$this->assertEquals (-1, $totalNumber);
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetBooksByLanguage ()
{
// All english book (= all books)
list ($entryArray, $totalNumber) = Book::getBooksByLanguage (1, -1);
$this->assertEquals (14, count($entryArray));
$this->assertEquals (-1, $totalNumber);
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetAllBooks ()
{
// All books by first letter
$entryArray = Book::getAllBooks ();
$this->assertCount (9, $entryArray);
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetBooksByStartingLetter ()
{
// All books by first letter
list ($entryArray, $totalNumber) = Book::getBooksByStartingLetter ("T", -1);
$this->assertEquals (-1, $totalNumber);
$this->assertCount (3, $entryArray);
}
2013-12-05 11:52:51 +02:00
public function testGetBookByDataId ()
2013-12-05 11:50:53 +02:00
{
$book = Book::getBookByDataId (17);
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$this->assertEquals ("Alice's Adventures in Wonderland", $book->getTitle ());
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetAllRecentBooks ()
{
// All recent books
global $config;
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$config['cops_recentbooks_limit'] = 2;
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$entryArray = Book::getAllRecentBooks ();
$this->assertCount (2, $entryArray);
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$config['cops_recentbooks_limit'] = 50;
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$entryArray = Book::getAllRecentBooks ();
$this->assertCount (15, $entryArray);
2013-12-05 11:50:53 +02:00
}
public function testGetBookById ()
{
// also check most of book's class methods
$book = Book::getBookById(2);
$linkArray = $book->getLinkArray ();
$this->assertCount (5, $linkArray);
2013-12-05 11:50:53 +02:00
$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 ("Arthur Conan Doyle", $book->getAuthorsName ());
2013-12-05 11:50:53 +02:00
$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 ("English", $book->getLanguages ());
2014-03-10 15:02:00 +02:00
$this->assertEquals ("&#9733;&#9733;&#9733;&#9733;&#9733;", $book->getRating ());
2013-12-05 11:50:53 +02:00
$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);
}
2013-12-05 11:52:51 +02:00
public function testBookGetLinkArrayWithUrlRewriting ()
{
global $config;
$book = Book::getBookById(2);
$config['cops_use_url_rewriting'] = "1";
$linkArray = $book->getLinkArray ();
foreach ($linkArray as $link) {
if ($link->rel == Link::OPDS_ACQUISITION_TYPE && $link->title == "EPUB" ) {
$this->assertEquals ("download/1/The+Return+of+Sherlock+Holmes+-+Arthur+Conan+Doyle.epub", $link->href);
return;
}
}
$this->fail ();
}
public function testBookGetLinkArrayWithoutUrlRewriting ()
{
global $config;
$book = Book::getBookById(2);
$config['cops_use_url_rewriting'] = "0";
$linkArray = $book->getLinkArray ();
foreach ($linkArray as $link) {
if ($link->rel == Link::OPDS_ACQUISITION_TYPE && $link->title == "EPUB" ) {
$this->assertEquals ("fetch.php?data=1&type=epub&id=2", $link->href);
return;
}
}
$this->fail ();
}
public function testGetThumbnailNotNeeded ()
{
$book = Book::getBookById(2);
$this->assertFalse ($book->getThumbnail (NULL, NULL, NULL));
// Current cover is 400*600
$this->assertFalse ($book->getThumbnail (COVER_WIDTH, NULL, NULL));
$this->assertFalse ($book->getThumbnail (COVER_WIDTH + 1, NULL, NULL));
$this->assertFalse ($book->getThumbnail (NULL, COVER_HEIGHT, NULL));
$this->assertFalse ($book->getThumbnail (NULL, COVER_HEIGHT + 1, NULL));
}
/**
* @dataProvider providerThumbnail
*/
public function testGetThumbnailByWidth ($width, $height, $expectedWidth, $expectedHeight)
{
$book = Book::getBookById(2);
$this->assertTrue ($book->getThumbnail ($width, $height, TEST_THUMBNAIL));
$size = GetImageSize(TEST_THUMBNAIL);
$this->assertEquals ($expectedWidth, $size [0]);
$this->assertEquals ($expectedHeight, $size [1]);
unlink (TEST_THUMBNAIL);
}
public function providerThumbnail ()
{
return array (
array (164, NULL, 164, 246),
array (NULL, 164, 109, 164)
);
}
2014-04-29 17:18:18 +03:00
public function testGetMostInterestingDataToSendToKindle_WithMOBI ()
2013-12-05 11:50:53 +02:00
{
// Get Alice (available as MOBI, PDF, EPUB in that order)
$book = Book::getBookById(17);
$data = $book->GetMostInterestingDataToSendToKindle ();
$this->assertEquals ("MOBI", $data->format);
2014-04-29 17:18:18 +03:00
}
public function testGetMostInterestingDataToSendToKindle_WithPdf ()
{
// Get Alice (available as MOBI, PDF, EPUB in that order)
$book = Book::getBookById(17);
$data = $book->GetMostInterestingDataToSendToKindle ();
2013-12-05 11:50:53 +02:00
array_shift ($book->datas);
$data = $book->GetMostInterestingDataToSendToKindle ();
$this->assertEquals ("PDF", $data->format);
2014-04-29 17:18:18 +03:00
}
public function testGetMostInterestingDataToSendToKindle_WithEPUB ()
{
// Get Alice (available as MOBI, PDF, EPUB in that order)
$book = Book::getBookById(17);
$data = $book->GetMostInterestingDataToSendToKindle ();
array_shift ($book->datas);
2013-12-05 11:50:53 +02:00
array_shift ($book->datas);
$data = $book->GetMostInterestingDataToSendToKindle ();
$this->assertEquals ("EPUB", $data->format);
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testGetDataById ()
{
global $config;
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
$book = Book::getBookById(17);
$mobi = $book->getDataById (17);
$this->assertEquals ("MOBI", $mobi->format);
$epub = $book->getDataById (20);
$this->assertEquals ("EPUB", $epub->format);
$this->assertEquals ("Carroll, Lewis - Alice's Adventures in Wonderland.epub", $epub->getUpdatedFilenameEpub ());
$this->assertEquals ("Carroll, Lewis - Alice's Adventures in Wonderland.kepub.epub", $epub->getUpdatedFilenameKepub ());
$this->assertEquals (dirname(__FILE__) . "/BaseWithSomeBooks/Lewis Carroll/Alice's Adventures in Wonderland (17)/Alice's Adventures in Wonderland - Lewis Carroll.epub", $epub->getLocalPath ());
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$config['cops_use_url_rewriting'] = "1";
$config['cops_provide_kepub'] = "1";
$_SERVER["HTTP_USER_AGENT"] = "Kobo";
$this->assertEquals ("download/20/Carroll%2C+Lewis+-+Alice%27s+Adventures+in+Wonderland.kepub.epub", $epub->getHtmlLink ());
2014-01-15 21:20:47 +02:00
$this->assertEquals ("download/17/Alice%27s+Adventures+in+Wonderland+-+Lewis+Carroll.mobi", $mobi->getHtmlLink ());
2013-12-05 11:50:53 +02:00
$_SERVER["HTTP_USER_AGENT"] = "Firefox";
2014-01-11 21:52:10 +02:00
$this->assertEquals ("download/20/Alice%27s+Adventures+in+Wonderland+-+Lewis+Carroll.epub", $epub->getHtmlLink ());
2013-12-05 11:50:53 +02:00
$config['cops_use_url_rewriting'] = "0";
$this->assertEquals ("fetch.php?data=20&type=epub&id=17", $epub->getHtmlLink ());
2013-12-05 11:50:53 +02:00
}
2013-12-05 11:52:51 +02:00
public function testGetFilePath_Cover () {
2013-12-15 15:44:10 +02:00
$book = Book::getBookById(17);
$this->assertEquals ("Lewis Carroll/Alice's Adventures in Wonderland (17)/cover.jpg", $book->getFilePath ("jpg", NULL, true));
}
public function testGetFilePath_Epub () {
$book = Book::getBookById(17);
2013-12-15 15:44:10 +02:00
$this->assertEquals ("Lewis Carroll/Alice's Adventures in Wonderland (17)/Alice's Adventures in Wonderland - Lewis Carroll.epub", $book->getFilePath ("epub", 20, true));
}
public function testGetFilePath_Mobi () {
$book = Book::getBookById(17);
2013-12-15 15:44:10 +02:00
$this->assertEquals ("Lewis Carroll/Alice's Adventures in Wonderland (17)/Alice's Adventures in Wonderland - Lewis Carroll.mobi", $book->getFilePath ("mobi", 17, true));
}
public function testGetDataFormat_EPUB () {
2013-12-15 16:08:20 +02:00
$book = Book::getBookById(17);
2013-12-15 16:08:20 +02:00
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
$data = $book->getDataFormat ("EPUB");
$this->assertEquals (20, $data->id);
}
public function testGetDataFormat_MOBI () {
$book = Book::getBookById(17);
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
2013-12-15 16:08:20 +02:00
$data = $book->getDataFormat ("MOBI");
$this->assertEquals (17, $data->id);
}
public function testGetDataFormat_PDF () {
$book = Book::getBookById(17);
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
2013-12-15 16:08:20 +02:00
$data = $book->getDataFormat ("PDF");
$this->assertEquals (19, $data->id);
}
public function testGetDataFormat_NonAvailable () {
$book = Book::getBookById(17);
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
2014-01-08 18:51:40 +02:00
$this->assertFalse ($book->getDataFormat ("FB2"));
2013-12-15 16:08:20 +02:00
}
2014-01-15 21:20:47 +02:00
public function testGetMimeType_EPUB () {
$book = Book::getBookById(17);
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
$data = $book->getDataFormat ("EPUB");
$this->assertEquals ("application/epub+zip", $data->getMimeType ());
}
public function testGetMimeType_MOBI () {
$book = Book::getBookById(17);
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
$data = $book->getDataFormat ("MOBI");
$this->assertEquals ("application/x-mobipocket-ebook", $data->getMimeType ());
}
public function testGetMimeType_PDF () {
$book = Book::getBookById(17);
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
$data = $book->getDataFormat ("PDF");
$this->assertEquals ("application/pdf", $data->getMimeType ());
}
public function testGetMimeType_Finfo () {
$book = Book::getBookById(17);
// Get Alice MOBI=>17, PDF=>19, EPUB=>20
$data = $book->getDataFormat ("PDF");
$this->assertEquals ("application/pdf", $data->getMimeType ());
2014-01-15 21:20:47 +02:00
// Alter a data to make a test for finfo_file if enabled
$data->extension = "ico";
$data->format = "ICO";
$data->name = "favicon";
$data->book->path = realpath (dirname(__FILE__) . "/../");
if (function_exists('finfo_open') === true) {
$this->assertEquals ("image/x-icon", $data->getMimeType ());
} else {
$this->assertEquals ("application/octet-stream", $data->getMimeType ());
}
}
2013-12-15 15:44:10 +02:00
public function testTypeaheadSearch_Tag ()
2013-12-05 11:50:53 +02:00
{
$_GET["page"] = Base::PAGE_OPENSEARCH_QUERY;
2013-12-05 11:50:53 +02:00
$_GET["query"] = "fic";
$_GET["search"] = "1";
2013-12-05 11:52:51 +02:00
$array = JSONRenderer::getJson ();
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$this->assertCount (3, $array);
$this->assertEquals ("2 tags", $array[0]["title"]);
$this->assertEquals ("Fiction", $array[1]["title"]);
$this->assertEquals ("Science Fiction", $array[2]["title"]);
2013-12-05 11:52:51 +02:00
$_GET["query"] = NULL;
$_GET["search"] = NULL;
}
public function testTypeaheadSearch_BookAndAuthor ()
{
$_GET["page"] = Base::PAGE_OPENSEARCH_QUERY;
2013-12-05 11:50:53 +02:00
$_GET["query"] = "car";
$_GET["search"] = "1";
2013-12-05 11:52:51 +02:00
$array = JSONRenderer::getJson ();
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$this->assertCount (4, $array);
$this->assertEquals ("1 book", $array[0]["title"]);
$this->assertEquals ("A Study in Scarlet", $array[1]["title"]);
$this->assertEquals ("1 author", $array[2]["title"]);
$this->assertEquals ("Carroll, Lewis", $array[3]["title"]);
2013-12-05 11:52:51 +02:00
$_GET["query"] = NULL;
$_GET["search"] = NULL;
}
public function testTypeaheadSearch_AuthorAndSeries ()
{
$_GET["page"] = Base::PAGE_OPENSEARCH_QUERY;
2013-12-05 11:50:53 +02:00
$_GET["query"] = "art";
$_GET["search"] = "1";
2013-12-05 11:52:51 +02:00
$array = JSONRenderer::getJson ();
2013-12-05 11:52:51 +02:00
$this->assertCount (5, $array);
2013-12-05 11:50:53 +02:00
$this->assertEquals ("1 author", $array[0]["title"]);
$this->assertEquals ("Doyle, Arthur Conan", $array[1]["title"]);
$this->assertEquals ("2 series", $array[2]["title"]);
2013-12-05 11:50:53 +02:00
$this->assertEquals ("D'Artagnan Romances", $array[3]["title"]);
$_GET["query"] = NULL;
$_GET["search"] = NULL;
}
public function testTypeaheadSearch_Publisher ()
{
$_GET["page"] = Base::PAGE_OPENSEARCH_QUERY;
2013-12-05 11:50:53 +02:00
$_GET["query"] = "Macmillan";
$_GET["search"] = "1";
$array = JSONRenderer::getJson ();
2013-12-05 11:50:53 +02:00
$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"]);
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$_GET["query"] = NULL;
$_GET["search"] = NULL;
}
public function testTypeaheadSearchWithIgnored_SingleCategory ()
{
global $config;
$_GET["page"] = Base::PAGE_OPENSEARCH_QUERY;
$_GET["query"] = "car";
$_GET["search"] = "1";
$config ['cops_ignored_categories'] = array ("author");
$array = JSONRenderer::getJson ();
$this->assertCount (2, $array);
$this->assertEquals ("1 book", $array[0]["title"]);
$this->assertEquals ("A Study in Scarlet", $array[1]["title"]);
$_GET["query"] = NULL;
$_GET["search"] = NULL;
}
public function testTypeaheadSearchWithIgnored_MultipleCategory ()
{
global $config;
$_GET["page"] = Base::PAGE_OPENSEARCH_QUERY;
$_GET["query"] = "art";
$_GET["search"] = "1";
$config ['cops_ignored_categories'] = array ("series");
$array = JSONRenderer::getJson ();
$this->assertCount (2, $array);
$this->assertEquals ("1 author", $array[0]["title"]);
$this->assertEquals ("Doyle, Arthur Conan", $array[1]["title"]);
$_GET["query"] = NULL;
2013-12-05 11:50:53 +02:00
$_GET["search"] = NULL;
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function testTypeaheadSearchMultiDatabase ()
{
global $config;
$_GET["page"] = Base::PAGE_OPENSEARCH_QUERY;
2013-12-05 11:50:53 +02:00
$_GET["query"] = "art";
$_GET["search"] = "1";
$_GET["multi"] = "1";
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
$config['calibre_directory'] = array ("Some books" => dirname(__FILE__) . "/BaseWithSomeBooks/",
"One book" => dirname(__FILE__) . "/BaseWithOneBook/");
2013-12-05 11:52:51 +02:00
$array = JSONRenderer::getJson ();
2013-12-05 11:52:51 +02:00
2013-12-16 22:41:34 +02:00
$this->assertCount (5, $array);
2013-12-05 11:50:53 +02:00
$this->assertEquals ("Some books", $array[0]["title"]);
2013-12-16 22:41:34 +02:00
$this->assertEquals ("1 author", $array[1]["title"]);
$this->assertEquals ("2 series", $array[2]["title"]);
2013-12-16 22:41:34 +02:00
$this->assertEquals ("One book", $array[3]["title"]);
$this->assertEquals ("1 book", $array[4]["title"]);
2013-12-05 11:50:53 +02:00
$_GET["query"] = NULL;
$_GET["search"] = NULL;
}
2013-12-05 11:52:51 +02:00
2013-12-05 11:50:53 +02:00
public function tearDown () {
Base::clearDb ();
}
2013-12-05 11:52:51 +02:00
2013-10-03 16:22:21 +03:00
}