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

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur LORENT committed May 30, 2018
1 parent 998eb36 commit 23b6b1f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/Unit/BuilderOverrideTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,21 @@ public function testFailedFindOrFail()
public function testPaginate()
{
$this->createMultipleDatabaseUsers(10);
$firstPageDatabaseUser = app(UserDatabase::class)->paginate();
$firstPageJsonUser = app(UserJson::class)->paginate();
$secondPageDatabaseUser = app(UserDatabase::class)->paginate(5, ['name'], 'page', 2);
$secondPageJsonUser = app(UserJson::class)->paginate(5, ['name'], 'page', 2);
$this->assertEquals($firstPageDatabaseUser->toArray(), $firstPageJsonUser->toArray());
$this->assertEquals($secondPageDatabaseUser->toArray(), $secondPageJsonUser->toArray());
$firstPageDatabaseUsers = app(UserDatabase::class)->paginate();
$firstPageJsonUsers = app(UserJson::class)->paginate();
$secondPageDatabaseUsers = app(UserDatabase::class)->paginate(5, ['name'], 'page', 2);
$secondPageJsonUsers = app(UserJson::class)->paginate(5, ['name'], 'page', 2);
// notice : we remove the created_at and updated_at fields that are not relevant and can be different
foreach ($firstPageDatabaseUsers as $key => $firstPageDatabaseUser) {
unset($firstPageDatabaseUser->created_at);
unset($firstPageDatabaseUser->updated_at);
}
foreach ($firstPageJsonUsers as $key => $firstPageJsonUser) {
unset($firstPageJsonUser->created_at);
unset($firstPageJsonUser->updated_at);
}
$this->assertEquals($secondPageDatabaseUsers->toArray(), $secondPageJsonUsers->toArray());
$this->assertEquals($secondPageDatabaseUsers->toArray(), $secondPageJsonUsers->toArray());
}

public function testValue()
Expand Down

0 comments on commit 23b6b1f

Please sign in to comment.