Laravel app boostraps early in testing environment

47 views Asked by At

Normally, application is bootstrapped after request being created. But in a test environment it happens before creating request.

That leads to socialiteproviders/manager implicitly creating request here, thinking it already exists. This request doesn't get used, and the other one is created after that.

As a result, I can't forge session data with withSession helper. Since it changes session created for latter request. And SocialiteProviders' provider always gets empty session.

If I disable bootstrapping it here, the first error I get is at this line, since application has not being bootstrapped yet.

Who's at fault? And how to fix it? And can you think of any workarounds meanwhile?

P.S. More details here.

1

There are 1 answers

0
x-yuri On BEST ANSWER

Well, if I had to answer who's at fault, I'd say it's socialiteproviders/manager, since it makes an assumption that request is already created when application is being bootstrapped. And here's the solution the way I see it.

To use it you add

{
    "type": "vcs",
    "url": "https://github.com/x-yuri/Manager"
}

to repositories parameter of composer.json. And do

$ composer require 'socialiteproviders/manager=dev-testing-boot as 2.2.1'

Do note though, using extra repositories slows composer down.