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

[11.x] Allows asserting no output in Artisan commands #50702

Merged
merged 3 commits into from
Mar 27, 2024

Conversation

nunomaduro
Copy link
Member

@nunomaduro nunomaduro commented Mar 21, 2024

This pull request allows to assert that Artisan commands don't provide any output:

test('backups', function () {
    $this->artisan('backup')
            ->doesntExpectOutput()
            ->assertExitCode(0);
});

At the same time, for feature parity, you may test that a command outputs something:

test('backups', function () {
    $this->artisan('say:hello') // outputs "hello"
            ->expectsOutput()
            ->assertExitCode(0);
});

@taylorotwell taylorotwell merged commit 4b4d5ad into 11.x Mar 27, 2024
29 checks passed
@taylorotwell taylorotwell deleted the feat/console-no-output branch March 27, 2024 19:55
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

Successfully merging this pull request may close these issues.

None yet

3 participants