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

Testing an Artisan command using render() #121

Closed
eleftrik opened this issue Feb 6, 2022 · 2 comments · Fixed by #123
Closed

Testing an Artisan command using render() #121

eleftrik opened this issue Feb 6, 2022 · 2 comments · Fixed by #123
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@eleftrik
Copy link

eleftrik commented Feb 6, 2022

Is it possible to test an Artisan command's console output (via expectsOutput, doesntExpectOutput) which is using, for example, render() function?

Artisan command foo:

...
render('bar'); // even with no styling/HTML
...

Unit PEST:

it('does not show output foo string', function () {
    $this->artisan('foo')
        ->doesntExpectOutput('bar');
});

Apparently, there is no difference between using render('bar') or not: the test always passes.
Am I doing anything wrong?

Thank you

@xiCO2k
Copy link
Collaborator

xiCO2k commented Feb 7, 2022

Hey @eleftrik, thanks for the issue, we want to support expectations, but is not yet available, if you want to contribute, feel free to do it.

I will keep this issue open.

Thanks.

@xiCO2k xiCO2k added enhancement New feature or request help wanted Extra attention is needed labels Feb 7, 2022
@nunomaduro
Copy link
Owner

@xiCO2k I think we should have a service provider, that automatically injects the command output on the renderUsing function...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
3 participants