Merge
This commit is contained in:
commit
27c0245a1b
BIN
test/metadata.db
BIN
test/metadata.db
Binary file not shown.
|
@ -35,6 +35,140 @@ class PageTest extends PHPUnit_Framework_TestCase
|
||||||
$this->assertFalse ($currentPage->ContainsBook ());
|
$this->assertFalse ($currentPage->ContainsBook ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testPageIndexWithCustomColumn ()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
$page = Base::PAGE_INDEX;
|
||||||
|
$query = NULL;
|
||||||
|
$search = NULL;
|
||||||
|
$qid = NULL;
|
||||||
|
$n = "1";
|
||||||
|
$database = NULL;
|
||||||
|
|
||||||
|
$config['cops_calibre_custom_column'] = array ("type1");
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertCount (7, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("Type1", $currentPage->entryArray [4]->title);
|
||||||
|
$this->assertEquals ("Alphabetical index of the 2 tags", $currentPage->entryArray [4]->content);
|
||||||
|
|
||||||
|
$config['cops_calibre_custom_column'] = array ("type2");
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertCount (7, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("Type2", $currentPage->entryArray [4]->title);
|
||||||
|
$this->assertEquals ("Alphabetical index of the 3 tags", $currentPage->entryArray [4]->content);
|
||||||
|
|
||||||
|
$config['cops_calibre_custom_column'] = array ("type4");
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertCount (7, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("Type4", $currentPage->entryArray [4]->title);
|
||||||
|
$this->assertEquals ("Alphabetical index of the 2 tags", $currentPage->entryArray [4]->content);
|
||||||
|
|
||||||
|
$config['cops_calibre_custom_column'] = array ("type1", "type2", "type4");
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertCount (9, $currentPage->entryArray);
|
||||||
|
|
||||||
|
$config['cops_calibre_custom_column'] = array ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPageAllCustom ()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
$page = Base::PAGE_ALL_CUSTOMS;
|
||||||
|
$query = NULL;
|
||||||
|
$search = NULL;
|
||||||
|
$qid = NULL;
|
||||||
|
$n = "1";
|
||||||
|
$database = NULL;
|
||||||
|
|
||||||
|
$_GET ["custom"] = "1";
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertEquals ("Type4", $currentPage->title);
|
||||||
|
$this->assertCount (2, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("SeriesLike", $currentPage->entryArray [0]->title);
|
||||||
|
$this->assertFalse ($currentPage->ContainsBook ());
|
||||||
|
|
||||||
|
$_GET ["custom"] = "2";
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertEquals ("Type2", $currentPage->title);
|
||||||
|
$this->assertCount (3, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("tag1", $currentPage->entryArray [0]->title);
|
||||||
|
$this->assertFalse ($currentPage->ContainsBook ());
|
||||||
|
|
||||||
|
$_GET ["custom"] = "3";
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertEquals ("Type1", $currentPage->title);
|
||||||
|
$this->assertCount (2, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("other", $currentPage->entryArray [0]->title);
|
||||||
|
$this->assertFalse ($currentPage->ContainsBook ());
|
||||||
|
|
||||||
|
$_GET ["custom"] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPageCustomDetail ()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
$page = Base::PAGE_CUSTOM_DETAIL;
|
||||||
|
$query = NULL;
|
||||||
|
$search = NULL;
|
||||||
|
$qid = "1";
|
||||||
|
$n = "1";
|
||||||
|
$database = NULL;
|
||||||
|
|
||||||
|
$_GET ["custom"] = "1";
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertEquals ("SeriesLike", $currentPage->title);
|
||||||
|
$this->assertCount (2, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("Alice's Adventures in Wonderland", $currentPage->entryArray [0]->title);
|
||||||
|
$this->assertTrue ($currentPage->ContainsBook ());
|
||||||
|
|
||||||
|
$_GET ["custom"] = "2";
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertEquals ("tag1", $currentPage->title);
|
||||||
|
$this->assertCount (2, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("Alice's Adventures in Wonderland", $currentPage->entryArray [0]->title);
|
||||||
|
$this->assertTrue ($currentPage->ContainsBook ());
|
||||||
|
|
||||||
|
$_GET ["custom"] = "3";
|
||||||
|
$qid = "2";
|
||||||
|
|
||||||
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
|
$this->assertEquals ("other", $currentPage->title);
|
||||||
|
$this->assertCount (1, $currentPage->entryArray);
|
||||||
|
$this->assertEquals ("A Study in Scarlet", $currentPage->entryArray [0]->title);
|
||||||
|
$this->assertTrue ($currentPage->ContainsBook ());
|
||||||
|
|
||||||
|
$_GET ["custom"] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
public function testPageAllAuthors ()
|
public function testPageAllAuthors ()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
Loading…
Reference in a new issue