From 9eb36752512b8b35bd8398fb32bf1bb4d55d9b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 30 Apr 2014 14:09:27 +0200 Subject: [PATCH] Again more test functions --- test/pageTest.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/pageTest.php b/test/pageTest.php index f3c6aa2..0a77d9b 100644 --- a/test/pageTest.php +++ b/test/pageTest.php @@ -548,7 +548,7 @@ class PageTest extends PHPUnit_Framework_TestCase $this->assertFalse ($currentPage->ContainsBook ()); } - public function testPageSearch () + public function testPageSearch_WithOnlyBooksReturned () { global $config; $page = Base::PAGE_OPENSEARCH_QUERY; @@ -565,9 +565,16 @@ class PageTest extends PHPUnit_Framework_TestCase $this->assertEquals ("Search result for *alice* in books", $currentPage->entryArray [0]->title); $this->assertEquals ("2 books", $currentPage->entryArray [0]->content); $this->assertFalse ($currentPage->ContainsBook ()); + } + public function testPageSearch_WithAuthorsIgnored () + { + global $config; + $page = Base::PAGE_OPENSEARCH_QUERY; // Match Lewis Caroll & Scarlet $query = "car"; + $qid = NULL; + $n = "1"; $config ['cops_ignored_categories'] = array ("author"); $currentPage = Page::getPage ($page, $qid, $query, $n); @@ -580,6 +587,17 @@ class PageTest extends PHPUnit_Framework_TestCase $this->assertFalse ($currentPage->ContainsBook ()); $config ['cops_ignored_categories'] = array (); + } + + public function testPageSearch_WithTwoCategories () + { + global $config; + $page = Base::PAGE_OPENSEARCH_QUERY; + // Match Lewis Caroll & Scarlet + $query = "car"; + $qid = NULL; + $n = "1"; + $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent ();