Skip to content

Commit

Permalink
Pager new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MashinaMashina committed Jan 14, 2020
1 parent 86ac8c8 commit 309afd1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/system/Pager/PagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@ public function testGetTotalPagesCalcsCorrectValue()

public function testGetNextURIUsesCurrentURI()
{
$_GET['page'] = 2;
$_GET['page_foo'] = 2;

$this->pager->store('foo', 2, 12, 70);

$expected = current_url(true);
$expected = (string)$expected->setQuery('page=3');
$expected = (string)$expected->setQuery('page_foo=3');

$this->assertEquals((string)$expected, $this->pager->getNextPageURI('foo'));
}
Expand All @@ -225,19 +225,19 @@ public function testGetNextURICorrectOnFirstPage()
$this->pager->store('foo', 1, 12, 70);

$expected = current_url(true);
$expected = (string)$expected->setQuery('page=2');
$expected = (string)$expected->setQuery('page_foo=2');

$this->assertEquals($expected, $this->pager->getNextPageURI('foo'));
}

public function testGetPreviousURIUsesCurrentURI()
{
$_GET['page'] = 2;
$_GET['page_foo'] = 2;

$this->pager->store('foo', 2, 12, 70);

$expected = current_url(true);
$expected = (string)$expected->setQuery('page=1');
$expected = (string)$expected->setQuery('page_foo=1');

$this->assertEquals((string)$expected, $this->pager->getPreviousPageURI('foo'));
}
Expand All @@ -252,28 +252,28 @@ public function testGetNextURIReturnsNullOnFirstPage()
public function testGetNextURIWithQueryStringUsesCurrentURI()
{
$_GET = [
'page' => 3,
'status' => 1,
'page_foo' => 3,
'status' => 1,
];

$expected = current_url(true);
$expected = (string)$expected->setQueryArray($_GET);

$this->pager->store('foo', $_GET['page'] - 1, 12, 70);
$this->pager->store('foo', $_GET['page_foo'] - 1, 12, 70);

$this->assertEquals((string)$expected, $this->pager->getNextPageURI('foo'));
}

public function testGetPreviousURIWithQueryStringUsesCurrentURI()
{
$_GET = [
'page' => 1,
'status' => 1,
'page_foo' => 1,
'status' => 1,
];
$expected = current_url(true);
$expected = (string)$expected->setQueryArray($_GET);

$this->pager->store('foo', $_GET['page'] + 1, 12, 70);
$this->pager->store('foo', $_GET['page_foo'] + 1, 12, 70);

$this->assertEquals((string)$expected, $this->pager->getPreviousPageURI('foo'));
}
Expand Down Expand Up @@ -383,12 +383,12 @@ public function testBasedURI()
$this->config = new Pager();
$this->pager = new \CodeIgniter\Pager\Pager($this->config, Services::renderer());

$_GET['page'] = 2;
$_GET['page_foo'] = 2;

$this->pager->store('foo', 2, 12, 70);

$expected = current_url(true);
$expected = (string)$expected->setQuery('page=1');
$expected = (string)$expected->setQuery('page_foo=1');

$this->assertEquals((string)$expected, $this->pager->getPreviousPageURI('foo'));
}
Expand Down

0 comments on commit 309afd1

Please sign in to comment.