I finally found the problem. Some time ago I was getting unit tests, and in applications / tests I saw this:
class TestCase extends Illuminate\Foundation\Testing\TestCase { public function createApplication(){ $unitTesting = true; $testEnvironment = 'testing'; return require __DIR__.'/../../bootstrap/start.php'; }
So I thought, “Awesome!” $ testENvironment is customizable. I hated "testing" by default because it is what we call our QA environment, so I changed it to "phpunit" and then created the app / config / phpunit / * files. He worked like a charm in development.
When I moved the code to our test environment, I started getting errors that the sessions were empty. At first I thought the laravel array session handler was broken, so I tried native, but it was broken too. But then I put some entries in the code and found that beforeFilters actually did not start, so there was no authentication, so the session was rightfully empty. So, I tracked the execution of code from the index to start automatic inclusion in dispatching, and down the routing path I found this little hard-coded jewel:
vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php 35 if ($app['env'] == 'testing') 36 { 37: $router->disableFilters(); 38 }
renaming our test environment to “test”, and our “phpunit” environment for “testing” fixes the problem.
Maybe I'll make a pull request to set this env name :)
source share