Author can now be searched by sort or by name (Carroll, Lewis or Lewis Carroll will work). fix #155

This commit is contained in:
Sébastien Lucas 2014-04-30 15:10:37 +02:00
parent d45bbb7ff6
commit 15e78a852a
3 changed files with 42 additions and 1 deletions

View file

@ -681,6 +681,42 @@ class PageTest extends PHPUnit_Framework_TestCase
$this->assertFalse ($currentPage->ContainsBook ());
}
public function testAuthorSearch_ByName ()
{
global $config;
$page = Base::PAGE_OPENSEARCH_QUERY;
$query = "Lewis Carroll";
$_GET ["scope"] = "author";
$qid = NULL;
$n = "1";
$currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent ();
$this->assertEquals ("Search result for *Lewis Carroll* in authors", $currentPage->title);
$this->assertCount (1, $currentPage->entryArray);
$this->assertEquals ("Carroll, Lewis", $currentPage->entryArray [0]->title);
$this->assertFalse ($currentPage->ContainsBook ());
}
public function testAuthorSearch_BySort ()
{
global $config;
$page = Base::PAGE_OPENSEARCH_QUERY;
$query = "Carroll, Lewis";
$_GET ["scope"] = "author";
$qid = NULL;
$n = "1";
$currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent ();
$this->assertEquals ("Search result for *Carroll, Lewis* in authors", $currentPage->title);
$this->assertCount (1, $currentPage->entryArray);
$this->assertEquals ("Carroll, Lewis", $currentPage->entryArray [0]->title);
$this->assertFalse ($currentPage->ContainsBook ());
}
public function testPageSearchScopeAuthors ()
{
$page = Base::PAGE_OPENSEARCH_QUERY;