From ddbe12984826ff956020fc7cf6e63929b5f8ad4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 4 Jun 2014 18:01:14 +0200 Subject: [PATCH] Split tests into proper functions --- test/pageTest.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/test/pageTest.php b/test/pageTest.php index c5f2772..31c1570 100644 --- a/test/pageTest.php +++ b/test/pageTest.php @@ -332,7 +332,7 @@ class PageTest extends PHPUnit_Framework_TestCase $this->assertFalse ($currentPage->ContainsBook ()); } - public function testPageAuthorsDetail () + public function testPageAuthorsDetail_FirstPage () { global $config; $page = Base::PAGE_AUTHOR_DETAIL; @@ -355,6 +355,18 @@ class PageTest extends PHPUnit_Framework_TestCase $this->assertTrue ($currentPage->IsPaginated ()); $this->assertNull ($currentPage->getPrevLink ()); + $config['cops_max_item_per_page'] = -1; + } + + public function testPageAuthorsDetail_LastPage () + { + 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"; + // Last page $config['cops_max_item_per_page'] = 5; $n = "2"; @@ -371,6 +383,19 @@ class PageTest extends PHPUnit_Framework_TestCase // No pagination $config['cops_max_item_per_page'] = -1; + } + + public function testPageAuthorsDetail_NoPagination () + { + 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"; + + // No pagination + $config['cops_max_item_per_page'] = -1; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent ();