From fed84c71714e4a1f8d6692fc5544338c855993de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 17:39:17 +0100 Subject: [PATCH] Add a test for typeahead search with multiple databases. re #96 --- test/bookTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/bookTest.php b/test/bookTest.php index f23c053..05f3193 100644 --- a/test/bookTest.php +++ b/test/bookTest.php @@ -172,4 +172,30 @@ class BookTest extends PHPUnit_Framework_TestCase $_GET["search"] = NULL; } + public function testTypeaheadSearchMultiDatabase () + { + global $config; + $_GET["query"] = "art"; + $_GET["search"] = "1"; + $_GET["multi"] = "1"; + + $config['calibre_directory'] = array ("Some books" => dirname(__FILE__) . "/BaseWithSomeBooks/", + "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); + + $array = getJson (); + + $this->assertCount (4, $array); + $this->assertEquals ("Some books", $array[0]["title"]); + $this->assertEquals ("No book", $array[1]["title"]); + $this->assertEquals ("One book", $array[2]["title"]); + $this->assertEquals ("1 book", $array[3]["title"]); + + $_GET["query"] = NULL; + $_GET["search"] = NULL; + } + + public function tearDown () { + Base::clearDb (); + } + } \ No newline at end of file