1
|
|
|
<?php |
2
|
|
|
namespace Pager\Tests; |
3
|
|
|
|
4
|
|
|
use Pager\Pagination; |
5
|
|
|
use PHPUnit\Framework\TestCase; |
6
|
|
|
|
7
|
|
|
class PaginationTest extends TestCase{ |
8
|
|
|
|
9
|
|
|
protected $pagination; |
10
|
|
|
|
11
|
|
|
public function setUp() { |
12
|
|
|
$this->pagination = new Pagination(); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
public function tearDown(){ |
16
|
|
|
unset($this->pagination); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @covers Pager\Pagination::paging |
21
|
|
|
* @covers Pager\Pagination::buildLink |
22
|
|
|
* @covers Pager\Pagination::getPage |
23
|
|
|
*/ |
24
|
|
|
public function testCreatePager(){ |
25
|
|
|
$this->pagination->paging(72, '/test-page'); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @covers Pager\Pagination::paging |
30
|
|
|
* @covers Pager\Pagination::buildLink |
31
|
|
|
* @covers Pager\Pagination::getPage |
32
|
|
|
*/ |
33
|
|
|
public function testNoPagerNeeded(){ |
34
|
|
|
$this->assertEquals('', $this->pagination->paging(10, '/test-page')); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @covers Pager\Pagination::setPaginationClass |
39
|
|
|
* @covers Pager\Pagination::getPaginationClass |
40
|
|
|
* @covers Pager\Pagination::paging |
41
|
|
|
* @covers Pager\Pagination::buildLink |
42
|
|
|
* @covers Pager\Pagination::getPage |
43
|
|
|
* @covers Pager\Pagination::preLinks |
44
|
|
|
* @covers Pager\Pagination::postLinks |
45
|
|
|
*/ |
46
|
|
|
public function testPagerWithArrows(){ |
47
|
|
|
$this->markTestIncomplete('Test not yet implemented'); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @covers Pager\Pagination::paging |
52
|
|
|
* @covers Pager\Pagination::buildLink |
53
|
|
|
* @covers Pager\Pagination::getPage |
54
|
|
|
* @covers Pager\Pagination::preLinks |
55
|
|
|
* @covers Pager\Pagination::postLinks |
56
|
|
|
*/ |
57
|
|
|
public function testPagerWithQueryString(){ |
58
|
|
|
$this->markTestIncomplete('Test not yet implemented'); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @covers Pager\Pagination::setPaginationClass |
63
|
|
|
* @covers Pager\Pagination::getPaginationClass |
64
|
|
|
*/ |
65
|
|
|
public function testSetPagerClass(){ |
66
|
|
|
$this->assertEquals('pagination', $this->pagination->getPaginationClass()); |
67
|
|
|
$this->pagination->setPaginationClass('my-class'); |
68
|
|
|
$this->assertNotEquals('pagination', $this->pagination->getPaginationClass()); |
69
|
|
|
$this->assertEquals('my-class', $this->pagination->getPaginationClass()); |
70
|
|
|
$this->pagination->setPaginationClass('paginationclass6'); |
71
|
|
|
$this->assertEquals('paginationclass6', $this->pagination->getPaginationClass()); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @covers Pager\Pagination::setPaginationClass |
76
|
|
|
* @covers Pager\Pagination::getPaginationClass |
77
|
|
|
*/ |
78
|
|
|
public function testSetActiveClass(){ |
79
|
|
|
$this->assertEquals('active', $this->pagination->getPaginationClass()); |
80
|
|
|
$this->pagination->setPaginationClass('current'); |
81
|
|
|
$this->assertNotEquals('active', $this->pagination->getPaginationClass()); |
82
|
|
|
$this->assertEquals('current', $this->pagination->getPaginationClass()); |
83
|
|
|
$this->pagination->setPaginationClass('current active-class'); |
84
|
|
|
$this->assertEquals('current active-class', $this->pagination->getPaginationClass()); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|