Add two new tests for OPDS to reach 100% coverage

This commit is contained in:
Sébastien Lucas 2014-06-04 22:44:47 +02:00
джерело e38ac8ea65
коміт 44049036ca
1 змінених файлів з 45 додано та 1 видалено

@ -189,7 +189,6 @@ class OpdsTest extends PHPUnit_Framework_TestCase
$_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1&n=1";
$config['cops_max_item_per_page'] = 2;
$config['cops_books_filter'] = array ("Only Short Stories" => "Short Stories", "No Short Stories" => "!Short Stories");
// First page
@ -216,4 +215,49 @@ class OpdsTest extends PHPUnit_Framework_TestCase
$config['cops_max_item_per_page'] = -1;
}
public function testPageAuthorsDetail_WithFacets ()
{
global $config;
$page = Base::PAGE_AUTHOR_DETAIL;
$query = NULL;
$qid = "1";
$n = "1";
$_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1&n=1";
$_GET["tag"] = "Short Stories";
$config['cops_books_filter'] = array ("Only Short Stories" => "Short Stories", "No Short Stories" => "!Short Stories");
$currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent ();
$OPDSRender = new OPDSRenderer ();
file_put_contents (TEST_FEED, $OPDSRender->render ($currentPage));
$this->AssertTrue ($this->opdsCompleteValidation (TEST_FEED));
$config['cops_books_filter'] = array ();
}
public function testPageAuthorsDetail_WithoutAnyId ()
{
global $config;
$page = Base::PAGE_AUTHOR_DETAIL;
$query = NULL;
$qid = "1";
$n = "1";
$_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1&n=1";
$_SERVER['REQUEST_URI'] = "index.php?XXXX";
$currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent ();
$currentPage->idPage = NULL;
$OPDSRender = new OPDSRenderer ();
file_put_contents (TEST_FEED, $OPDSRender->render ($currentPage));
$this->AssertTrue ($this->opdsCompleteValidation (TEST_FEED));
}
}