Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container issues in v3.7.0 #229

Closed
antonkomarev opened this issue Sep 8, 2018 · 8 comments
Closed

Container issues in v3.7.0 #229

antonkomarev opened this issue Sep 8, 2018 · 8 comments
Assignees

Comments

@antonkomarev
Copy link
Contributor

antonkomarev commented Sep 8, 2018

When I'm running $ vendor/bin/phpunit there is fatal error:

PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Console\Kernel] is not instantiable. in /home/ell/Projects/laravel/laravel-love/vendor/laravel/framework/src/Illuminate/Container/Container.php:933

When Travis trying to run the tests there is another one error:

PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/travis/build/cybercog/laravel-love/vendor/laravel/framework/src/Illuminate/Container/Container.php:933

But when I'm running tests using PHPStorm IDE all tests are green (there are no issues).

v3.6.0 working without any issues.

Here is a link to failing PR.

@crynobone
Copy link
Member

There no changes in container between 5.6 to 5.7 illuminate/container@5.6...5.7

Futhermore Travis also throws that the tests having php memory limits exception. You might want to increase that first since you have no problem running this locally.

@antonkomarev
Copy link
Contributor Author

antonkomarev commented Sep 9, 2018

I've found solution. It's happens because $this->artisan returns PendingCommand instead of output. But this new console behavior could be turned off.

If there is a need to support Laravel 5.7 as well as earlier framework versions you could use withoutMockingConsoleOutput method before the artisan call.

if (starts_with($this->app->version(), '5.7')) {
    $this->withoutMockingConsoleOutput();
}

@mikebronner
Copy link
Contributor

Thanks @antonkomarev I was having this problem as well with my console command unit tests.

@crynobone
Copy link
Member

crynobone commented Sep 11, 2018

This should be added to the README documentation. PR are welcomed

@crynobone
Copy link
Member

I'm open to adding artisanWithoutMock() as prefered alternative to artisan() method.

@antonkomarev
Copy link
Contributor Author

@crynobone I've created PR to the Laravel core: laravel/framework#25573
If it will be rejected - I'll migrate it to this repo.

@antonkomarev
Copy link
Contributor Author

I've pushed another one solution which seems more flexible for me: laravel/framework#25574

@antonkomarev
Copy link
Contributor Author

PR was merged, so we will be able to use run method for immediately command execution on PendingCommand in next release.

$output = $this->artisan('foo:bar')->run();

stefanzweifel added a commit to stefanzweifel/laravel-stats that referenced this issue Sep 17, 2018
Laravel 5.7 changed how Artisan test can be tested. It now comes with a PendingCommand. A fix in the framework has already been merged (orchestral/testbench#229 (comment)) and will be available in a future release.

This change fixes the problem in the current release.
@crynobone crynobone self-assigned this Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants