Description
Laravel 5 module isn't allowing the IoC bindings introduced in version 2.2.2 to be bound for the first request. I've tracked this down to the logic in the __construct / doRequest of Laravel5.php.
https://github.com/Codeception/Codeception/blob/2.2.6/src/Codeception/Lib/Connector/Laravel5.php#L89
On construct it's initialised, during which the bindings are applied as part of initialise
This means that automatically, on the first request there can never be any bindings set at all due to this piece of code :
So to confirm, here's the flow of a typical test pseudo style
- start the test
- construct the l5 connector
- apply the bindings via initilise (no binding set yet)
- set singletons / binds etc in the test (binds are set but not applied)
- run request against laravel (no bindings applied due to the firstRequest check)
- change page
- apply the bindings via initilise (bindings now applied)
After dumping some debug around the code :
Test: tests/functional/InitialLoadCest.php:tryToTestBindings
Scenario --
"construct l5 module"
" first request? 1"
"initilize"
"apply bindings"
I have singleton "SomeInterface#000000006e01e7310000558df9aaf7e0"
"bind singleton" <=== No further apply bindings before request is made
I am on route "design.index"
So for my work around to this I'll need to make a request to some page which doesn't require the IoC binding and then follow through with the proper requests.
Let me know if you need a test project supplied, however the logic for this issue is fairly straight forward unless I've missed something glaringly obvious.