Add a test in multiple database. failing for the moment. re #96
This commit is contained in:
		
							parent
							
								
									e3b2a20423
								
							
						
					
					
						commit
						5576d81684
					
				
					 1 changed files with 62 additions and 0 deletions
				
			
		|  | @ -44,6 +44,7 @@ class OpdsTest extends PHPUnit_Framework_TestCase | ||||||
|         $database = NULL; |         $database = NULL; | ||||||
| 
 | 
 | ||||||
|         $_SERVER['QUERY_STRING'] = ""; |         $_SERVER['QUERY_STRING'] = ""; | ||||||
|  |         $config['cops_subtitle_default'] = "My subtitle"; | ||||||
| 
 | 
 | ||||||
|         $currentPage = Page::getPage ($page, $qid, $query, $n); |         $currentPage = Page::getPage ($page, $qid, $query, $n); | ||||||
|         $currentPage->InitializeContent (); |         $currentPage->InitializeContent (); | ||||||
|  | @ -58,4 +59,65 @@ class OpdsTest extends PHPUnit_Framework_TestCase | ||||||
|         $_SERVER['QUERY_STRING'] = NULL; |         $_SERVER['QUERY_STRING'] = NULL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public function testPageIndexMultipleDatabase () | ||||||
|  |     { | ||||||
|  |         global $config; | ||||||
|  |         $config['calibre_directory'] = array ("Some books" => dirname(__FILE__) . "/BaseWithSomeBooks/", | ||||||
|  |                                               "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); | ||||||
|  |         $page = Base::PAGE_AUTHOR_DETAIL; | ||||||
|  |         $query = NULL; | ||||||
|  |         $search = NULL; | ||||||
|  |         $qid = "1"; | ||||||
|  |         $n = "1"; | ||||||
|  |         $database = NULL; | ||||||
|  |         $_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1"; | ||||||
|  |         $_GET ["db"] = "0"; | ||||||
|  | 
 | ||||||
|  |         $currentPage = Page::getPage ($page, $qid, $query, $n); | ||||||
|  |         $currentPage->InitializeContent (); | ||||||
|  | 
 | ||||||
|  |         $OPDSRender = new OPDSRenderer (); | ||||||
|  | 
 | ||||||
|  |         file_put_contents (TEST_FEED, $OPDSRender->render ($currentPage)); | ||||||
|  |         $this->AssertTrue ($this->opdsValidateSchema (TEST_FEED)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public function testPageAuthorsDetail () | ||||||
|  |     { | ||||||
|  |         global $config; | ||||||
|  |         $page = Base::PAGE_AUTHOR_DETAIL; | ||||||
|  |         $query = NULL; | ||||||
|  |         $search = NULL; | ||||||
|  |         $qid = "1"; | ||||||
|  |         $n = "1"; | ||||||
|  |         $database = NULL; | ||||||
|  |         $_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1&n=1"; | ||||||
|  | 
 | ||||||
|  |         $config['cops_max_item_per_page'] = 2; | ||||||
|  | 
 | ||||||
|  |         // First page
 | ||||||
|  | 
 | ||||||
|  |         $currentPage = Page::getPage ($page, $qid, $query, $n); | ||||||
|  |         $currentPage->InitializeContent (); | ||||||
|  | 
 | ||||||
|  |         $OPDSRender = new OPDSRenderer (); | ||||||
|  | 
 | ||||||
|  |         file_put_contents (TEST_FEED, $OPDSRender->render ($currentPage)); | ||||||
|  |         $this->AssertTrue ($this->opdsValidateSchema (TEST_FEED)); | ||||||
|  | 
 | ||||||
|  |         // Second page
 | ||||||
|  | 
 | ||||||
|  |         $n = 2; | ||||||
|  |         $currentPage = Page::getPage ($page, $qid, $query, $n); | ||||||
|  |         $currentPage->InitializeContent (); | ||||||
|  | 
 | ||||||
|  |         $OPDSRender = new OPDSRenderer (); | ||||||
|  | 
 | ||||||
|  |         file_put_contents (TEST_FEED, $OPDSRender->render ($currentPage)); | ||||||
|  |         $this->AssertTrue ($this->opdsValidateSchema (TEST_FEED)); | ||||||
|  | 
 | ||||||
|  |         // No pagination
 | ||||||
|  |         $config['cops_max_item_per_page'] = -1; | ||||||
|  | 
 | ||||||
|  |     } | ||||||
| } | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue