Add new test for search page. re #96
This commit is contained in:
parent
aca14938ca
commit
a4d9e28cdb
|
@ -482,4 +482,36 @@ class PageTest extends PHPUnit_Framework_TestCase
|
||||||
$this->assertFalse ($currentPage->ContainsBook ());
|
$this->assertFalse ($currentPage->ContainsBook ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testPageSearch ()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
$page = Base::PAGE_OPENSEARCH_QUERY;
|
||||||
|
$query = "alice";
|
||||||
|
$search = NULL;
|
||||||
|
$qid = NULL;
|
||||||
|
$n = "1";
|
||||||
|
$database = NULL;
|
||||||
|
|
||||||
|
// Only books returned
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertEquals ("Search result for *alice*", $currentPage->title);
|
||||||
|
$this->assertCount (2, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("Alice's Adventures in Wonderland", $currentPage->entryArray [0]->title);
|
||||||
|
$this->assertEquals ("Through the Looking Glass (And What Alice Found There)", $currentPage->entryArray [1]->title);
|
||||||
|
$this->assertTrue ($currentPage->ContainsBook ());
|
||||||
|
|
||||||
|
// Only books returned
|
||||||
|
$query = "car";
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertEquals ("Search result for *car*", $currentPage->title);
|
||||||
|
$this->assertCount (3, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("Alice's Adventures in Wonderland", $currentPage->entryArray [0]->title);
|
||||||
|
$this->assertEquals ("A Study in Scarlet", $currentPage->entryArray [1]->title);
|
||||||
|
$this->assertEquals ("Through the Looking Glass (And What Alice Found There)", $currentPage->entryArray [2]->title);
|
||||||
|
$this->assertTrue ($currentPage->ContainsBook ());
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue