Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
StyleCI last checks
Browse files Browse the repository at this point in the history
  • Loading branch information
juampi92 committed Feb 24, 2018
1 parent 0f1ff41 commit 48c355a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/CursorPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct($items, $perPage, array $options = [])
$this->request = request();
}

$this->cursor = CursorPaginator::resolveCurrentCursor($this->request);
$this->cursor = self::resolveCurrentCursor($this->request);

$this->query = $this->getRawQuery();
$this->path = $this->path !== '/' ? rtrim($this->path, '/') : rtrim($this->request->path(), '/');
Expand All @@ -68,7 +68,7 @@ public function __construct($items, $perPage, array $options = [])
/**
* Set the items for the paginator.
*
* @param mixed $items
* @param mixed $items
*
* @return void
*/
Expand Down Expand Up @@ -242,8 +242,8 @@ public function lastItem()
/**
* Render the paginator using a given view.
*
* @param string|null $view
* @param array $data
* @param string|null $view
* @param array $data
*
* @return string
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/CursorPaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function test_overflow_pagination()
], $perPage = 2);

$this->assertEquals($p->items(), [
$array[0], $array[1]
$array[0], $array[1],
]);
}

Expand All @@ -45,7 +45,7 @@ public function test_empty_next_if_no_more()
$p = new CursorPaginator($array = [
(object) ['id' => 1],
(object) ['id' => 2],
(object) ['id' => 3]
(object) ['id' => 3],
], $perPage = 3);

$this->assertEquals($p->nextCursor(), null);
Expand Down
1 change: 0 additions & 1 deletion tests/Fixtures/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class User extends Model
{

protected $guarded = [];

protected $primaryKey = '_id';
Expand Down
3 changes: 0 additions & 3 deletions tests/MacroTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class MacroTest extends ModelsTestCase
{

public function test_exist()
{
$macroName = 'cursorPaginate';
Expand Down Expand Up @@ -105,6 +104,4 @@ public function test_both_pagination()

$this->assertEquals(count($p->toArray()['data']), $prev_val - $next_val - 1);
}


}
1 change: 1 addition & 0 deletions tests/ModelsTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected function setUpRoutes(Application $app)
});
\Route::get('/test/resource', function () {
$res = (new \Illuminate\Http\Resources\Json\ResourceCollection(User::cursorPaginate(5)));

return $res->toResponse(request())->getContent();
});
}
Expand Down
12 changes: 6 additions & 6 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function test_resource()

$response->assertJsonFragment([
"meta" => [
"path" => "test/resource?",
"path" => 'test/resource?',
"next_cursor" => (string) $next_cur,
"per_page" => 5,
"previous_cursor" => (string) $prev_cur,
Expand All @@ -60,10 +60,10 @@ public function test_prev_nav()

$response->assertJsonFragment([
"meta" => [
"path" => "test/resource?",
"path" => 'test/resource?',
"next_cursor" => null,
"per_page" => 5,
"previous_cursor" => (string) $prev_cur // Casted to string
"previous_cursor" => (string) $prev_cur,
],
]);
}
Expand All @@ -87,7 +87,7 @@ public function test_more_middle_pagination()

$response->assertJsonFragment([
"meta" => [
"path" => "test/resource?",
"path" => 'test/resource?',
"next_cursor" => (string) $prev_cur_added,
"per_page" => 5,
"previous_cursor" => (string) $first,
Expand Down Expand Up @@ -117,7 +117,7 @@ public function test_prev_is_still_present()

$response->assertJsonFragment([
"meta" => [
"path" => "test/resource?",
"path" => 'test/resource?',
"next_cursor" => (string) $next_cur_after,
"per_page" => 5,
"previous_cursor" => null,
Expand Down Expand Up @@ -147,7 +147,7 @@ public function test_surroundings_finished()

$response->assertJsonFragment([
"meta" => [
"path" => "test/resource?",
"path" => 'test/resource?',
"next_cursor" => null,
"per_page" => 5,
"previous_cursor" => null,
Expand Down

0 comments on commit 48c355a

Please sign in to comment.