Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Cast linkCollection to array #34245

Merged
merged 1 commit into from
Sep 10, 2020
Merged

[8.x] Cast linkCollection to array #34245

merged 1 commit into from
Sep 10, 2020

Conversation

iamgergo
Copy link
Contributor

The new linksCollection method stays a collection instance when calling paginate()->toArray().
The genererated JSON will be the same, so this should not affect anything.

Some tests can fail because it expects an array and gets a collection. For example in my inertia app:

$response->assertPropValue('results', function ($results) {
    $this->assertEquals(
        $results,
        $this->user->addresses()->paginate(25)->toArray()
     );
});
--- Expected
+++ Actual
@@ @@
     'from' => 1
     'last_page' => 1
     'last_page_url' => 'http://localhost/bazar/users/...page=1'
-    'links' => Array (...)
+    'links' => Illuminate\Support\Collection Object (...)
     'next_page_url' => null
     'path' => 'http://localhost/bazar/users/...resses'
     'per_page' => 25

@szepeviktor
Copy link
Contributor

Some tests can fail

And they do fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants