Merge pull request #137 from miicha/master
raw sketch of ratings category
This commit is contained in:
		
						commit
						5792c62068
					
				
					 18 changed files with 220 additions and 25 deletions
				
			
		
							
								
								
									
										37
									
								
								base.php
									
										
									
									
									
								
							
							
						
						
									
										37
									
								
								base.php
									
										
									
									
									
								
							|  | @ -3,7 +3,7 @@ | |||
|  * COPS (Calibre OPDS PHP Server) class file | ||||
|  * | ||||
|  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) | ||||
|  * @author     Sébastien Lucas <sebastien@slucas.fr> | ||||
|  * @author     S<EFBFBD>bastien Lucas <sebastien@slucas.fr> | ||||
|  */ | ||||
| 
 | ||||
| define ("VERSION", "0.9.1beta"); | ||||
|  | @ -438,6 +438,10 @@ class Page | |||
|                 return new PageAllCustoms ($id, $query, $n); | ||||
|             case Base::PAGE_CUSTOM_DETAIL : | ||||
|                 return new PageCustomDetail ($id, $query, $n); | ||||
|             case Base::PAGE_ALL_RATINGS : | ||||
|                 return new PageAllRating ($id, $query, $n); | ||||
|             case Base::PAGE_RATING_DETAIL : | ||||
|                 return new PageRatingDetail ($id, $query, $n); | ||||
|             case Base::PAGE_ALL_SERIES : | ||||
|                 return new PageAllSeries ($id, $query, $n); | ||||
|             case Base::PAGE_ALL_BOOKS : | ||||
|  | @ -474,7 +478,7 @@ class Page | |||
|         $this->query = $pquery; | ||||
|         $this->n = $pn; | ||||
|         $this->favicon = $config['cops_icon']; | ||||
|         $this->authorName = empty($config['cops_author_name']) ? utf8_encode('Sébastien Lucas') : $config['cops_author_name']; | ||||
|         $this->authorName = empty($config['cops_author_name']) ? utf8_encode('S<EFBFBD>bastien Lucas') : $config['cops_author_name']; | ||||
|         $this->authorUri = empty($config['cops_author_uri']) ? 'http://blog.slucas.fr' : $config['cops_author_uri']; | ||||
|         $this->authorEmail = empty($config['cops_author_email']) ? 'sebastien@slucas.fr' : $config['cops_author_email']; | ||||
|     } | ||||
|  | @ -510,6 +514,10 @@ class Page | |||
|                 $tags = Tag::getCount(); | ||||
|                 if (!is_null ($tags)) array_push ($this->entryArray, $tags); | ||||
|             } | ||||
|             if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) { | ||||
|                 $rating = Rating::getCount(); | ||||
|                 if (!is_null ($rating)) array_push ($this->entryArray, $rating); | ||||
|             } | ||||
|             if (!in_array ("language", getCurrentOption ('ignored_categories'))) { | ||||
|                 $languages = Language::getCount(); | ||||
|                 if (!is_null ($languages)) array_push ($this->entryArray, $languages); | ||||
|  | @ -707,6 +715,27 @@ class PageSerieDetail extends Page | |||
|     } | ||||
| } | ||||
| 
 | ||||
| class PageAllRating extends Page | ||||
| { | ||||
|     public function InitializeContent () | ||||
|     { | ||||
|         $this->title = localize("ratings.title"); | ||||
|         $this->entryArray = Rating::getAllRatings(); | ||||
|         $this->idPage = Rating::ALL_RATING_ID; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| class PageRatingDetail extends Page | ||||
| { | ||||
|     public function InitializeContent () | ||||
|     { | ||||
|         $rating = Rating::getRatingById ($this->idGet); | ||||
|         $this->idPage = $rating->getEntryId (); | ||||
|         $this->title =str_format (localize ("ratingword", $rating->name/2), $rating->name/2); | ||||
|         list ($this->entryArray, $this->totalNumber) = Book::getBooksByRating ($this->idGet, $this->n); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| class PageAllBooks extends Page | ||||
| { | ||||
|     public function InitializeContent () | ||||
|  | @ -750,6 +779,7 @@ class PageRecentBooks extends Page | |||
| class PageQueryResult extends Page | ||||
| { | ||||
|     const SCOPE_TAG = "tag"; | ||||
|     const SCOPE_RATING = "rating"; | ||||
|     const SCOPE_SERIES = "series"; | ||||
|     const SCOPE_AUTHOR = "author"; | ||||
|     const SCOPE_BOOK = "book"; | ||||
|  | @ -957,6 +987,7 @@ class PageCustomize extends Page | |||
|                                    PageQueryResult::SCOPE_TAG, | ||||
|                                    PageQueryResult::SCOPE_SERIES, | ||||
|                                    PageQueryResult::SCOPE_PUBLISHER, | ||||
|                                    PageQueryResult::SCOPE_RATING, | ||||
|                                    "language"); | ||||
| 
 | ||||
|         $content = ""; | ||||
|  | @ -1029,6 +1060,8 @@ abstract class Base | |||
|     const PAGE_CUSTOMIZE = "19"; | ||||
|     const PAGE_ALL_PUBLISHERS = "20"; | ||||
|     const PAGE_PUBLISHER_DETAIL = "21"; | ||||
|     const PAGE_ALL_RATINGS = "22"; | ||||
|     const PAGE_RATING_DETAIL = "23"; | ||||
| 
 | ||||
|     const COMPATIBILITY_XML_ALDIKO = "aldiko"; | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										8
									
								
								book.php
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								book.php
									
										
									
									
									
								
							|  | @ -9,6 +9,7 @@ | |||
| require_once('base.php'); | ||||
| require_once('serie.php'); | ||||
| require_once('author.php'); | ||||
| require_once('rating.php'); | ||||
| require_once('publisher.php'); | ||||
| require_once('tag.php'); | ||||
| require_once('language.php'); | ||||
|  | @ -44,6 +45,8 @@ define ('SQL_BOOKS_QUERY', "select {0} from books " . SQL_BOOKS_LEFT_JOIN . " | |||
|                                                     title like ?) {1} order by books.sort");
 | ||||
| define ('SQL_BOOKS_RECENT', "select {0} from books " . SQL_BOOKS_LEFT_JOIN . " | ||||
|                                                     where 1=1 {1} order by timestamp desc limit ");
 | ||||
| define ('SQL_BOOKS_BY_RATING', "select {0} from books " . SQL_BOOKS_LEFT_JOIN . " | ||||
|                                                     where books_ratings_link.book = books.id and ratings.id = ? {1} order by sort");												
 | ||||
| 
 | ||||
| class Book extends Base { | ||||
|     const ALL_BOOKS_UUID = "urn:uuid"; | ||||
|  | @ -62,6 +65,7 @@ class Book extends Base { | |||
|     const SQL_BOOKS_BY_CUSTOM = SQL_BOOKS_BY_CUSTOM; | ||||
|     const SQL_BOOKS_QUERY = SQL_BOOKS_QUERY; | ||||
|     const SQL_BOOKS_RECENT = SQL_BOOKS_RECENT; | ||||
|     const SQL_BOOKS_BY_RATING = SQL_BOOKS_BY_RATING; | ||||
| 
 | ||||
|     const BAD_SEARCH = "QQQQQ"; | ||||
| 
 | ||||
|  | @ -447,6 +451,10 @@ class Book extends Base { | |||
|         return self::getEntryArray (self::SQL_BOOKS_BY_AUTHOR, array ($authorId), $n); | ||||
|     } | ||||
| 
 | ||||
|     public static function getBooksByRating($ratingId, $n) { | ||||
|         return self::getEntryArray (self::SQL_BOOKS_BY_RATING, array ($ratingId), $n); | ||||
|     }	 | ||||
| 	 | ||||
|     public static function getBooksByPublisher($publisherId, $n) { | ||||
|         return self::getEntryArray (self::SQL_BOOKS_BY_PUBLISHER, array ($publisherId), $n); | ||||
|     } | ||||
|  |  | |||
|  | @ -244,6 +244,7 @@ | |||
|      * - series | ||||
|      * - tag | ||||
|      * - publisher | ||||
|      * - rating | ||||
|      * - language | ||||
|      */ | ||||
|     $config ['cops_ignored_categories'] = array (); | ||||
|  |  | |||
|  | @ -3,13 +3,14 @@ | |||
|  * COPS (Calibre OPDS PHP Server) HTML main script | ||||
|  * | ||||
|  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) | ||||
|  * @author     S<EFBFBD>bastien Lucas <sebastien@slucas.fr> | ||||
|  * @author     Sébastien Lucas <sebastien@slucas.fr> | ||||
|  * | ||||
|  */ | ||||
| 
 | ||||
|     require_once ("config.php"); | ||||
|     require_once ("base.php"); | ||||
|     require_once ("author.php"); | ||||
|     require_once ("rating.php"); | ||||
|     require_once ("publisher.php"); | ||||
|     require_once ("serie.php"); | ||||
|     require_once ("tag.php"); | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "##TODO##publisherword.many":"{0} publishers", | ||||
| "##TODO##publisherword.none":"No publisher", | ||||
| "##TODO##publisherword.one":"1 publisher", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"{0} darrers títols incorporats", | ||||
| "recent.title":"Els més recents", | ||||
| "##TODO##search.alternate":"Search", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "publisherword.many":"{0} Verlage", | ||||
| "publisherword.none":"Kein Verlag", | ||||
| "publisherword.one":"1 Verlag", | ||||
| "ratings.title":"Bewertung", | ||||
| "ratings.many":"{0} verschiedene Bewertungen", | ||||
| "ratings.none":"Keine Bewertungen", | ||||
| "ratings.one":"{0} Bewertung", | ||||
| "ratingword.many":"{0} Sterne", | ||||
| "ratingword.none":"{0} Sterne", | ||||
| "ratingword.one":"{0} Stern", | ||||
| "recent.list":"{0} neue Bücher", | ||||
| "recent.title":"Neuzugänge", | ||||
| "search.alternate":"Suche", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "publisherword.many":"{0} publishers", | ||||
| "publisherword.none":"No publisher", | ||||
| "publisherword.one":"1 publisher", | ||||
| "ratings.title":"Rating", | ||||
| "ratings.many":"{0} different ratings", | ||||
| "ratings.none":"no ratings", | ||||
| "ratings.one":"{0} ratings", | ||||
| "ratingword.many":"{0} stars", | ||||
| "ratingword.none":"{0} stars", | ||||
| "ratingword.one":"{0} star", | ||||
| "recent.list":"{0} most recent books", | ||||
| "recent.title":"Recent additions", | ||||
| "search.alternate":"Search", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "publisherword.many":"{0} editoriales", | ||||
| "publisherword.none":"No hay editoriales", | ||||
| "publisherword.one":"1 editorial", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"{0} libros más recientes", | ||||
| "recent.title":"Añadidos recientemente", | ||||
| "search.alternate":"Buscar", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "publisherword.many":"{0} éditeurs", | ||||
| "publisherword.none":"Aucun éditeur", | ||||
| "publisherword.one":"1 éditeur", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"{0} livres les plus récents", | ||||
| "recent.title":"Ajouts récents", | ||||
| "search.alternate":"Rechercher", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "publisherword.many":"{0} editori", | ||||
| "publisherword.none":"Nessun editore", | ||||
| "publisherword.one":"1 editore", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":" I {0} libri più recenti", | ||||
| "recent.title":"Ultime aggiunte", | ||||
| "search.alternate":"Cerca", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "##TODO##publisherword.many":"{0} publishers", | ||||
| "##TODO##publisherword.none":"No publisher", | ||||
| "##TODO##publisherword.one":"1 publisher", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"{0} nyeste bøker", | ||||
| "recent.title":"Nylig lagt til", | ||||
| "search.alternate":"Søk", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "publisherword.many":"{0} uitgevers", | ||||
| "publisherword.none":"Geen uitgever", | ||||
| "publisherword.one":"1 uitgever", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"{0} meest recente boeken", | ||||
| "recent.title":"Recent toegevoegde boeken", | ||||
| "search.alternate":"Zoeken", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "publisherword.many":"{0} editoras", | ||||
| "publisherword.none":"Sem editora", | ||||
| "publisherword.one":"1 editora", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"{0} livros mais recentes", | ||||
| "recent.title":"Adições recentes", | ||||
| "search.alternate":"Pesquisar", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "##TODO##publisherword.many":"{0} publishers", | ||||
| "##TODO##publisherword.none":"No publisher", | ||||
| "##TODO##publisherword.one":"1 publisher", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"{0} недавно поступивших(ие) книг(и)", | ||||
| "recent.title":"Недавние поступления", | ||||
| "search.alternate":"Поиск", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "publisherword.many":"{0} förlag", | ||||
| "publisherword.none":"Inget förlag", | ||||
| "publisherword.one":"1 förlag", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"De {0} senaste böckerna", | ||||
| "recent.title":"Nya böcker", | ||||
| "search.alternate":"Sök", | ||||
|  |  | |||
|  | @ -48,6 +48,13 @@ | |||
| "##TODO##publisherword.many":"{0} publishers", | ||||
| "##TODO##publisherword.none":"No publisher", | ||||
| "##TODO##publisherword.one":"1 publisher", | ||||
| "##TODO##ratings.title":"", | ||||
| "##TODO##ratings.many":"", | ||||
| "##TODO##ratings.none":"", | ||||
| "##TODO##ratings.one":"", | ||||
| "##TODO##ratingword.many":"", | ||||
| "##TODO##ratingword.none":"", | ||||
| "##TODO##ratingword.one":"", | ||||
| "recent.list":"{0} 本最近添加的书", | ||||
| "recent.title":"最近添加", | ||||
| "search.alternate":"搜索", | ||||
|  |  | |||
							
								
								
									
										65
									
								
								rating.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								rating.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,65 @@ | |||
| <?php | ||||
| /** | ||||
|  * COPS (Calibre OPDS PHP Server) class file | ||||
|  * | ||||
|  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) | ||||
|  * @author     Michael Pfitzner | ||||
|  */ | ||||
| 
 | ||||
| require_once('base.php'); | ||||
| 
 | ||||
| class Rating extends Base { | ||||
|     const ALL_RATING_ID = "cops:rating"; | ||||
| 
 | ||||
|     const RATING_COLUMNS = "ratings.id as id, ratings.rating as rating, count(*) as count"; | ||||
|     const SQL_ALL_RATINGS ="select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating"; | ||||
|     public $id; | ||||
|     public $name; | ||||
|     public $sort; | ||||
| 
 | ||||
|     public function __construct($pid, $pname) { | ||||
|         $this->id = $pid; | ||||
|         $this->name = $pname; | ||||
|     } | ||||
| 
 | ||||
|     public function getUri () { | ||||
|         return "?page=".parent::PAGE_RATING_DETAIL."&id=$this->id"; | ||||
|     } | ||||
| 
 | ||||
|     public function getEntryId () { | ||||
|         return self::ALL_RATING_ID.":".$this->id; | ||||
|     } | ||||
| 
 | ||||
|     public static function getCount() { | ||||
|         $nRatings = parent::getDb ()->query('select count(*) from ratings')->fetchColumn(); | ||||
|         $entry = new Entry (localize("ratings.title"), self::ALL_RATING_ID, | ||||
|             str_format (localize("ratings", $nRatings), $nRatings), "text", | ||||
|             array ( new LinkNavigation ("?page=".parent::PAGE_ALL_RATINGS))); | ||||
|         return $entry; | ||||
|     } | ||||
| 
 | ||||
|     public static function getAllRatings() { | ||||
|         return self::getEntryArray (self::SQL_ALL_RATINGS, array ()); | ||||
|     } | ||||
| 
 | ||||
|     public static function getEntryArray ($query, $params) { | ||||
|         list ($totalNumber, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1); | ||||
|         $entryArray = array(); | ||||
|         while ($post = $result->fetchObject ()) | ||||
|         { | ||||
|             $ratingObj = new Rating ($post->id, $post->rating); | ||||
|             $rating=$post->rating/2; | ||||
|             $rating = str_format (localize("ratingword", $rating), $rating); | ||||
|             array_push ($entryArray, new Entry ($rating, $ratingObj->getEntryId (), | ||||
|                 str_format (localize("bookword", $post->count), $post->count), "text", | ||||
|                 array ( new LinkNavigation ($ratingObj->getUri ())))); | ||||
|         } | ||||
|         return $entryArray; | ||||
|     } | ||||
| 
 | ||||
|     public static function getRatingById ($ratingId) { | ||||
|         $result = parent::getDb ()->prepare('select rating from ratings where id = ?'); | ||||
|         $result->execute (array ($ratingId)); | ||||
|         return new Author ($ratingId, $result->fetchColumn ()); | ||||
|     } | ||||
| } | ||||
|  | @ -23,7 +23,7 @@ class PageTest extends PHPUnit_Framework_TestCase | |||
|         $currentPage->InitializeContent (); | ||||
| 
 | ||||
|         $this->assertEquals ($config['cops_title_default'], $currentPage->title); | ||||
|         $this->assertCount (7, $currentPage->entryArray); | ||||
|         $this->assertCount (8, $currentPage->entryArray); | ||||
|         $this->assertEquals ("Authors", $currentPage->entryArray [0]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 5 authors", $currentPage->entryArray [0]->content); | ||||
|         $this->assertEquals ("Series", $currentPage->entryArray [1]->title); | ||||
|  | @ -32,12 +32,14 @@ class PageTest extends PHPUnit_Framework_TestCase | |||
|         $this->assertEquals ("Alphabetical index of the 5 publishers", $currentPage->entryArray [2]->content); | ||||
|         $this->assertEquals ("Tags", $currentPage->entryArray [3]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 10 tags", $currentPage->entryArray [3]->content); | ||||
|         $this->assertEquals ("Languages", $currentPage->entryArray [4]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the single language", $currentPage->entryArray [4]->content); | ||||
|         $this->assertEquals ("All books", $currentPage->entryArray [5]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 14 books", $currentPage->entryArray [5]->content); | ||||
|         $this->assertEquals ("Recent additions", $currentPage->entryArray [6]->title); | ||||
|         $this->assertEquals ("50 most recent books", $currentPage->entryArray [6]->content); | ||||
|         $this->assertEquals ("Rating", $currentPage->entryArray [4]->title); | ||||
|         $this->assertEquals ("no ratings", $currentPage->entryArray [4]->content); | ||||
|         $this->assertEquals ("Languages", $currentPage->entryArray [5]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the single language", $currentPage->entryArray [5]->content); | ||||
|         $this->assertEquals ("All books", $currentPage->entryArray [6]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 14 books", $currentPage->entryArray [6]->content); | ||||
|         $this->assertEquals ("Recent additions", $currentPage->entryArray [7]->title); | ||||
|         $this->assertEquals ("50 most recent books", $currentPage->entryArray [7]->content); | ||||
|         $this->assertFalse ($currentPage->ContainsBook ()); | ||||
|     } | ||||
| 
 | ||||
|  | @ -55,11 +57,12 @@ class PageTest extends PHPUnit_Framework_TestCase | |||
|         $currentPage->InitializeContent (); | ||||
| 
 | ||||
|         $this->assertEquals ($config['cops_title_default'], $currentPage->title); | ||||
|         $this->assertCount (2, $currentPage->entryArray); | ||||
|         $this->assertEquals ("All books", $currentPage->entryArray [0]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 14 books", $currentPage->entryArray [0]->content); | ||||
|         $this->assertEquals ("Recent additions", $currentPage->entryArray [1]->title); | ||||
|         $this->assertEquals ("50 most recent books", $currentPage->entryArray [1]->content); | ||||
|         $this->assertCount (3, $currentPage->entryArray); | ||||
|         $this->assertEquals ("Rating", $currentPage->entryArray [0]->title); | ||||
|         $this->assertEquals ("All books", $currentPage->entryArray [1]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 14 books", $currentPage->entryArray [1]->content); | ||||
|         $this->assertEquals ("Recent additions", $currentPage->entryArray [2]->title); | ||||
|         $this->assertEquals ("50 most recent books", $currentPage->entryArray [2]->content); | ||||
|         $this->assertFalse ($currentPage->ContainsBook ()); | ||||
|     } | ||||
| 
 | ||||
|  | @ -77,34 +80,34 @@ class PageTest extends PHPUnit_Framework_TestCase | |||
|         $currentPage = Page::getPage ($page, $qid, $query, $n); | ||||
|         $currentPage->InitializeContent (); | ||||
| 
 | ||||
|         $this->assertCount (8, $currentPage->entryArray); | ||||
|         $this->assertEquals ("Type1", $currentPage->entryArray [5]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 2 tags", $currentPage->entryArray [5]->content); | ||||
|         $this->assertCount (9, $currentPage->entryArray); | ||||
|         $this->assertEquals ("Type1", $currentPage->entryArray [6]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 2 tags", $currentPage->entryArray [6]->content); | ||||
| 
 | ||||
|         $config['cops_calibre_custom_column'] = array ("type2"); | ||||
| 
 | ||||
|         $currentPage = Page::getPage ($page, $qid, $query, $n); | ||||
|         $currentPage->InitializeContent (); | ||||
| 
 | ||||
|         $this->assertCount (8, $currentPage->entryArray); | ||||
|         $this->assertEquals ("Type2", $currentPage->entryArray [5]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 3 tags", $currentPage->entryArray [5]->content); | ||||
|         $this->assertCount (9, $currentPage->entryArray); | ||||
|         $this->assertEquals ("Type2", $currentPage->entryArray [6]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 3 tags", $currentPage->entryArray [6]->content); | ||||
| 
 | ||||
|         $config['cops_calibre_custom_column'] = array ("type4"); | ||||
| 
 | ||||
|         $currentPage = Page::getPage ($page, $qid, $query, $n); | ||||
|         $currentPage->InitializeContent (); | ||||
| 
 | ||||
|         $this->assertCount (8, $currentPage->entryArray); | ||||
|         $this->assertEquals ("Type4", $currentPage->entryArray [5]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 2 tags", $currentPage->entryArray [5]->content); | ||||
|         $this->assertCount (9, $currentPage->entryArray); | ||||
|         $this->assertEquals ("Type4", $currentPage->entryArray [6]->title); | ||||
|         $this->assertEquals ("Alphabetical index of the 2 tags", $currentPage->entryArray [6]->content); | ||||
| 
 | ||||
|         $config['cops_calibre_custom_column'] = array ("type1", "type2", "type4"); | ||||
| 
 | ||||
|         $currentPage = Page::getPage ($page, $qid, $query, $n); | ||||
|         $currentPage->InitializeContent (); | ||||
| 
 | ||||
|         $this->assertCount (10, $currentPage->entryArray); | ||||
|         $this->assertCount (11, $currentPage->entryArray); | ||||
| 
 | ||||
|         $config['cops_calibre_custom_column'] = array (); | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue