-
-
Notifications
You must be signed in to change notification settings - Fork 209
Fixing a bug in testing with Laravel Prompts #505
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
base: master
Are you sure you want to change the base?
Fixing a bug in testing with Laravel Prompts #505
Conversation
I think that However, this may be something that would be good to add into the base RE your example, I wasn't able to replicate this on macOS (I instead get a warning that no assertions were made), would you be able to provide an example repository? |
At the time the Issue was created in March 2024, the playback steps were up to date and I was able to get this error several times in a row. Now I am getting a different error on these steps: $ ./vendor/bin/pest --filter FooTest
WARN Tests\Unit\FooTest
! it some → This test did not perform any assertions 0.29s
Tests: 1 risky (0 assertions)
Duration: 0.40s
PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Console\Kernel] is not instantiable. in D:\domains\movie-cli\vendor\illuminate\container\Container.php:1216
Stack trace:
#0 D:\domains\movie-cli\vendor\illuminate\container\Container.php(968): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...')
#1 D:\domains\movie-cli\vendor\illuminate\container\Container.php(832): Illuminate\Container\Container->build('Illuminate\\Cont...')
#2 D:\domains\movie-cli\vendor\laravel-zero\foundation\src\Illuminate\Foundation\Application.php(1084): Illuminate\Container\Container->resolve('Illuminate\\Cont...', Array, true)
#3 D:\domains\movie-cli\vendor\illuminate\container\Container.php(763): Illuminate\Foundation\Application->resolve('Illuminate\\Cont...', Array)
#4 D:\domains\movie-cli\vendor\laravel-zero\foundation\src\Illuminate\Foundation\Application.php(1064): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#5 D:\domains\movie-cli\vendor\illuminate\testing\PendingCommand.php(331): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#6 D:\domains\movie-cli\vendor\illuminate\testing\PendingCommand.php(534): Illuminate\Testing\PendingCommand->run()
#7 [internal function]: Illuminate\Testing\PendingCommand->__destruct()
#8 {main}
thrown in D:\domains\movie-cli\vendor\illuminate\container\Container.php on line 1216 I need some time to identify the reasons for the failure to run the tests and update the step instructions for reproduction. |
For reference, tests that interact with the framework should likely be in |
Feature usually contains tests that interact with the framework through API requests, and Unit usually contains tests that check the operation of any parts of the application “under the hood” (command calls, classes, integrations, etc.). |
I'm more meaning that in a default Laravel Zero application, the |
@owenvoke you can see a repository: https://github.com/andrey-helldar/temp-laravel-zero-with-prompts git clone git@github.com:andrey-helldar/temp-laravel-zero-with-prompts.git test-prompts && cd test-prompts
composer install
vendor/bin/pest --filter FooTest I ran into two new problems when updating the playback steps: Problem 1: -it('some', fn () => test()->artisan(FooCommand::class)
- ->expectsQuestion('First question', 'qwerty')
- ->expectsOutputToContain('First is qwerty')
- ->assertSuccessful()
-);
+it('some', function () {
+ test()->artisan(FooCommand::class)
+ ->expectsQuestion('First question', 'qwerty')
+ ->expectsOutputToContain('First is qwerty')
+ ->assertSuccessful();
+}); Problem 2: And then we get an error. There is no such error when running under Windows. |
Yes, can replicate the issue with that repository on macOS. 👍🏻 I'll try and look into why it hangs. |
I've tried it on the following OS:
|
Description
When testing any function from Laravel Prompts in Unix that accepts a value, an error occurs.
Steps to reproduce
composer create-project --prefer-dist laravel-zero/laravel-zero movie-cli cd movie-cli composer require laravel/prompts ./application make:command FooCommand ./application make:test FooTest
Results
Windows (not wsl)
Any non Windows OS (include WSL)
Reason
Because:
https://github.com/laravel/framework/blob/12.x/src/Illuminate/Console/Concerns/ConfiguresPrompts.php#L36