From 906e792bb803733338a82cf2e7b751789af77745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 23 Dec 2013 11:44:26 +0100 Subject: [PATCH] Add a check with ignored categories with typeahead. re #34 --- test/bookTest.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/bookTest.php b/test/bookTest.php index d6d7860..a2fac8f 100644 --- a/test/bookTest.php +++ b/test/bookTest.php @@ -341,6 +341,35 @@ class BookTest extends PHPUnit_Framework_TestCase $_GET["search"] = NULL; } + public function testTypeaheadSearchWithIgnored () + { + global $config; + $_GET["page"] = Base::PAGE_OPENSEARCH_QUERY; + $_GET["query"] = "car"; + $_GET["search"] = "1"; + + $config ['cops_ignored_categories'] = array ("author"); + $array = getJson (); + + $this->assertCount (2, $array); + $this->assertEquals ("1 book", $array[0]["title"]); + $this->assertEquals ("A Study in Scarlet", $array[1]["title"]); + + + $_GET["query"] = "art"; + $_GET["search"] = "1"; + + $config ['cops_ignored_categories'] = array ("series"); + $array = getJson (); + + $this->assertCount (2, $array); + $this->assertEquals ("1 author", $array[0]["title"]); + $this->assertEquals ("Doyle, Arthur Conan", $array[1]["title"]); + + $_GET["query"] = NULL; + $_GET["search"] = NULL; + } + public function testTypeaheadSearchMultiDatabase () { global $config;