Skip to content

Commit c89ba56

Browse files
authored
Merge pull request #6596 from ddevsr/docs-pager
2 parents 8a93b65 + 23be5bf commit c89ba56

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

system/Pager/Pager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function store(string $group, int $page, ?int $perPage, int $total, int $
158158
/**
159159
* Sets segment for a group.
160160
*
161-
* @return mixed
161+
* @return $this
162162
*/
163163
public function setSegment(int $number, string $group = 'default')
164164
{
@@ -174,7 +174,7 @@ public function setSegment(int $number, string $group = 'default')
174174
/**
175175
* Sets the path that an aliased group of links will use.
176176
*
177-
* @return mixed
177+
* @return $this
178178
*/
179179
public function setPath(string $path, string $group = 'default')
180180
{

system/Pager/PagerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ public function makeLinks(int $page, int $perPage, int $total, string $template
4242
* Stores a set of pagination data for later display. Most commonly used
4343
* by the model to automate the process.
4444
*
45-
* @return mixed
45+
* @return $this
4646
*/
4747
public function store(string $group, int $page, int $perPage, int $total);
4848

4949
/**
5050
* Sets the path that an aliased group of links will use.
5151
*
52-
* @return mixed
52+
* @return $this
5353
*/
5454
public function setPath(string $path, string $group = 'default');
5555

tests/system/Pager/PagerTest.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use CodeIgniter\Pager\Exceptions\PagerException;
1919
use CodeIgniter\Test\CIUnitTestCase;
2020
use Config\App;
21-
use Config\Pager;
21+
use Config\Pager as PagerConfig;
2222
use Config\Services;
2323

2424
/**
@@ -28,7 +28,7 @@
2828
*/
2929
final class PagerTest extends CIUnitTestCase
3030
{
31-
private ?\CodeIgniter\Pager\Pager $pager = null;
31+
private ?Pager $pager = null;
3232
private $config;
3333

3434
protected function setUp(): void
@@ -58,8 +58,8 @@ private function createPager(string $requestUri): void
5858
$request = $request->withMethod('GET');
5959
Services::injectMock('request', $request);
6060

61-
$this->config = new Pager();
62-
$this->pager = new \CodeIgniter\Pager\Pager($this->config, Services::renderer());
61+
$this->config = new PagerConfig();
62+
$this->pager = new Pager($this->config, Services::renderer());
6363
}
6464

6565
public function testSetPathRemembersPath()
@@ -180,6 +180,15 @@ public function testStoreWithSegments()
180180
);
181181
}
182182

183+
public function testGetPageURIWithURIReturnObject()
184+
{
185+
$this->pager->store('bar', 5, 25, 100, 1);
186+
187+
$uri = $this->pager->getPageURI(7, 'bar', true);
188+
189+
$this->assertInstanceOf(URI::class, $uri);
190+
}
191+
183192
public function testHasMoreDefaultsToFalse()
184193
{
185194
$this->assertFalse($this->pager->hasMore('foo'));
@@ -463,8 +472,8 @@ public function testBasedURI()
463472

464473
Services::injectMock('request', $request);
465474

466-
$this->config = new Pager();
467-
$this->pager = new \CodeIgniter\Pager\Pager($this->config, Services::renderer());
475+
$this->config = new PagerConfig();
476+
$this->pager = new Pager($this->config, Services::renderer());
468477

469478
$_GET['page_foo'] = 2;
470479

0 commit comments

Comments
 (0)