Anybody???
I prepared a demo.
git clone https://github.com/dokimastikos/lumen-auth-error.git demo
composer update
phpunit
Install clean Lumen 5.2
Uncomment the dollowing in bootstrap/app.php
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
]);
$app->register(App\Providers\AuthServiceProvider::class);
Add middleware
$app->get('/', function () use ($app) {
return $app->version();
})->middleware('auth');
Run phpunit and .... BOOM. Returns infinite loop errors
HPUnit 4.8.21 by Sebastian Bergmann and contributors.
PHP Fatal error: Maximum function nesting level of '256' reached, aborting! in /Users/thomaspb/Desktop/bug-error/vendor/illuminate/container/Container.php on line 700
PHP Stack trace:
PHP 1. {main}() /Users/thomaspb/.composer/vendor/phpunit/phpunit/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /Users/thomaspb/.composer/vendor/phpunit/phpunit/phpunit:47
PHP 3. PHPUnit_TextUI_Command->run() /Users/thomaspb/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:100
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /Users/thomaspb/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:149
PHP 5. PHPUnit_Framework_TestSuite->run() /Users/thomaspb/Desktop/bug-error/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
PHP 6. PHPUnit_Framework_TestSuite->run() /Users/thomaspb/Desktop/bug-error/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP 7. PHPUnit_Framework_TestCase->run() /Users/thomaspb/Desktop/bug-error/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP 8. PHPUnit_Framework_TestResult->run() /Users/thomaspb/Desktop/bug-error/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
PHP 9. PHPUnit_Framework_TestCase->runBare() /Users/thomaspb/Desktop/bug-error/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
...
...
...
If I run the controller from browser works fine. The problem exists only in phpunit tests.
Do you know anything about this problem?
Please or to participate in this conversation.