mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
parent
f2beee5185
commit
b60a666df2
2 changed files with 18 additions and 1 deletions
|
@ -98,12 +98,13 @@ class EntryRestController extends WallabagRestController
|
|||
$tags = $request->query->get('tags', '');
|
||||
$since = $request->query->get('since', 0);
|
||||
|
||||
/** @var \Pagerfanta\Pagerfanta $pager */
|
||||
$pager = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findEntries($this->getUser()->getId(), $isArchived, $isStarred, $sort, $order, $since, $tags);
|
||||
|
||||
$pager->setCurrentPage($page);
|
||||
$pager->setMaxPerPage($perPage);
|
||||
$pager->setCurrentPage($page);
|
||||
|
||||
$pagerfantaFactory = new PagerfantaFactory('page', 'perPage');
|
||||
$paginatedCollection = $pagerfantaFactory->createRepresentation(
|
||||
|
|
|
@ -156,6 +156,22 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
$this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
|
||||
}
|
||||
|
||||
public function testGetEntriesOnPageTwo()
|
||||
{
|
||||
$this->client->request('GET', '/api/entries', [
|
||||
'page' => 2,
|
||||
'perPage' => 2,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
|
||||
$content = json_decode($this->client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertGreaterThanOrEqual(0, $content['total']);
|
||||
$this->assertEquals(2, $content['page']);
|
||||
$this->assertEquals(2, $content['limit']);
|
||||
}
|
||||
|
||||
public function testGetStarredEntries()
|
||||
{
|
||||
$this->client->request('GET', '/api/entries', ['starred' => 1, 'sort' => 'updated']);
|
||||
|
|
Loading…
Reference in a new issue