Skip to content
This repository was archived by the owner on Feb 10, 2019. It is now read-only.

Commit

Permalink
Added more assertions - fixed php5?
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinvdburgt committed Mar 20, 2018
1 parent 5f2c54a commit 862916d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Folklore/GraphQL/Support/PaginationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class PaginationType extends ObjectType
{
public function __construct(string $type)
public function __construct($type)
{
parent::__construct([
'name' => $type . 'Pagination',
Expand Down
7 changes: 6 additions & 1 deletion tests/PaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PaginationTest extends FieldTest
*
* @test
*/
public function testPaginationHasCursor()
public function testPagination()
{
$take = 2;
$page = 1;
Expand All @@ -21,11 +21,16 @@ public function testPaginationHasCursor()
]);

// Assert
$items = $result['data']['examplesPagination']['items'];
$cursor = $result['data']['examplesPagination']['cursor'];

$this->assertEquals($cursor['total'], count($this->data));
$this->assertEquals($cursor['perPage'], $take);
$this->assertEquals($cursor['currentPage'], $page);
$this->assertEquals($cursor['hasPages'], count($this->data) > $take);

$this->assertEquals(count($items), $take);
$this->assertEquals($items[0]['test'], $this->data[0]['test']);
$this->assertEquals($items[1]['test'], $this->data[1]['test']);
}
}

0 comments on commit 862916d

Please sign in to comment.