diff --git a/console-tests.md b/console-tests.md index 98c8f59a601..8ae16b7ceef 100644 --- a/console-tests.md +++ b/console-tests.md @@ -90,6 +90,28 @@ public function test_console_command(): void } ``` +You may also assert that a console command does not generate any output using the `doesntExpectOutput` method: + +```php tab=Pest +test('console command', function () { + $this->artisan('example') + ->doesntExpectOutput() + ->assertExitCode(0); +}); +``` + +```php tab=PHPUnit +/** + * Test a console command. + */ +public function test_console_command(): void +{ + $this->artisan('example') + ->doesntExpectOutput() + ->assertExitCode(0); +} +``` + #### Confirmation Expectations