Skip to content

5.4.19 seems to break my unit tests - eloquent model db connection inconsistency #18837

Closed
@fgreinus

Description

@fgreinus

Description:

When I upgraded from laravel/framework 5.4.18 to 5.4.19 some of my unit tests broke. This is because somehow the models i get when making http requests (via the BrowserKitTest features) now have a connection provided, while the user i create via a factory and then use within the application via $this->actingAs have null as db connection. This leads to false returns when doing checks via $user->is($modelFromRouteModelBinding->user);

Steps To Reproduce:

Use $this->actingAs($userFromFactory) in BrowserKitTests and then call some of your routes via $this->json('GET', '/test') or so. When you use checks i.e. for security like $userFromRequest->is($modelFromRouteModelBinding->user), you will get false because the connections differ (null vs the (now) correct connection).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions