Browse Source

Add two new tests for OPDS to reach 100% coverage

master
Sébastien Lucas 10 years ago
parent
commit
44049036ca
1 changed files with 45 additions and 1 deletions
  1. +45
    -1
      test/OPDSTest.php

+ 45
- 1
test/OPDSTest.php View File

@@ -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));

}
}

Loading…
Cancel
Save