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

Providing no value when asking a question hangs up pest/phpunit #365

Open
likeadeckofcards opened this issue Dec 3, 2021 · 2 comments
Open

Comments

@likeadeckofcards
Copy link

While trying to write tests around running a command that prompts for input which has a defaulted value, if I run the following commands pest/phpunit fails to process and does not give any output with regards to any tests that were ran.

test('Project init defaults the slug to the project url', function() {
    $this->artisan('project:init')
        ->expectsQuestion('If known, enter the url for the project', 'test.com')
        ->expectsQuestion('Enter the slug you want to use for this project', '') // simulate the user not entering a value
        ->expectsTable(
            ['Argument', 'Value'],
            [
                ['url', 'test.com'],
                ['slug', 'testcom'],
            ]
        )->assertExitCode(0);
});

I was able to locate the issue in the Laravel Framework repo but I am not sure if submitting a pull request to the main Laravel Framework is the right approach or if it is possible that there is a bug somewhere else in the stack. Here is the fix that I created.

@likeadeckofcards likeadeckofcards changed the title Providing Default value when asking a question hangs up pest Providing Default value when asking a question hangs up pest/phpunit Dec 3, 2021
@likeadeckofcards likeadeckofcards changed the title Providing Default value when asking a question hangs up pest/phpunit Providing no value when asking a question hangs up pest/phpunit Dec 3, 2021
@owenvoke
Copy link
Member

owenvoke commented Dec 3, 2021

Does this work when using null instead of ''? 🤔

@likeadeckofcards
Copy link
Author

@owenvoke using null instead of '' results in an exception being thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants