-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
228 additions
and
103 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use URL; | ||
use Pagination; | ||
|
||
class CSSTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testCSS() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<li class="page-item current"><a href="' . URL::site('Home/main/0') . '" class="page-link">1</a></li>', | ||
Pagination::limit(15) | ||
->totalRows(200) | ||
->countLinks(3) | ||
->linkNames('[ prev ]', '[ next ]', '[+ first +]', '[+ last +]') | ||
->css(['links' => 'links', 'current' => 'current']) | ||
->create() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use URL; | ||
use Pagination; | ||
|
||
class CountLinksTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testCountLinks() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<a href="' . URL::site('Home/main/10') . '" class="page-link">2</a>', | ||
Pagination::countLinks(2)->limit(10)->totalRows(100)->create() | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use URL; | ||
use Pagination; | ||
|
||
class CreateTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testCreate() | ||
{ | ||
$this->assertStringContainsString('Home/main/40', Pagination::create()); | ||
} | ||
|
||
public function testLast() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<a href="' . URL::site('Home/main/190') . '" class="page-link">20</a>', | ||
Pagination::linkNames('prev', 'next', 'first', 'last')->limit(10)->countLinks(5)->totalRows(200)->create(190) | ||
); | ||
} | ||
|
||
public function testFirst() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<a href="' . URL::site('Home/main/190') . '" class="page-link">last</a>', | ||
Pagination::linkNames('prev', 'next', 'first', 'last')->limit(10)->countLinks(5)->totalRows(200)->create(0) | ||
); | ||
} | ||
|
||
public function testMiddle() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<a href="' . URL::site('Home/main/0') . '" class="page-link">first</a>', | ||
Pagination::linkNames('prev', 'next', 'first', 'last')->limit(10)->countLinks(5)->totalRows(200)->create(100) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use Pagination; | ||
|
||
class GETURITest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testGetURI() | ||
{ | ||
$this->assertEquals('Home/main/', Pagination::getURI()); | ||
} | ||
|
||
public function testGetURIWithFirstParameter() | ||
{ | ||
$this->assertEquals('Home/main/bar?example=1', Pagination::getURI('bar?example=1')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use URL; | ||
use Pagination; | ||
|
||
class LimitTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testLimit() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<a href="' . URL::site('Home/main/45') . '" class="page-link">10</a>', | ||
Pagination::limit(5)->create() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use URL; | ||
use Pagination; | ||
|
||
class LinkNamesTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testLinkNames() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<a href="' . URL::site('Home/main/10') . '" class="page-link">[ next ]</a></li>', | ||
Pagination::linkNames('[ prev ]', '[ next ]', '[+ first +]', '[+ last +]')->create() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use Pagination; | ||
|
||
class OutputTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testOutput() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<ul class="pagination">', | ||
Pagination::output('bootstrap') | ||
->limit(15) | ||
->totalRows(75) | ||
->countLinks(5) | ||
->create() | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use URL; | ||
use Pagination; | ||
|
||
class StartTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testStart() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<li class="page-item active"><a href="' . URL::site('Home/main/20') . '" class="page-link">3</a></li>', | ||
Pagination::url('Home/main')->start(20)->create() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use URL; | ||
use Pagination; | ||
|
||
class StyleTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testStyle() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<li class="page-item active" style="font-size:30px;"><a href="' . URL::site('Home/main/0') . '" class="page-link">1</a></li><li style="color:green;"><a href="' . URL::site('Home/main/15') . '" class="page-link">2</a></li>', | ||
Pagination::limit(15) | ||
->totalRows(200) | ||
->countLinks(3) | ||
->linkNames('[ prev ]', '[ next ]', '[+ first +]', '[+ last +]') | ||
->style(['links' => 'color:green;', 'current' => 'font-size:30px;']) | ||
->create() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use URL; | ||
use Pagination; | ||
|
||
class TotalRowsTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testTotalRows() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<a href="' . URL::site('Home/main/40') . '" class="page-link">3</a>', | ||
Pagination::limit(20)->totalRows(45)->create() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use Pagination; | ||
|
||
class TypeTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testType() | ||
{ | ||
$this->assertStringContainsString | ||
( | ||
'<ul class="pagination">', | ||
Pagination::output('bootstrap') | ||
->type('ajax') | ||
->limit(15) | ||
->totalRows(75) | ||
->countLinks(5) | ||
->create() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php namespace ZN\Pagination; | ||
|
||
use Pagination; | ||
|
||
class URLTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testURL() | ||
{ | ||
$this->assertStringContainsString('product/list/40', Pagination::url('product/list')->create()); | ||
} | ||
} |