From de5cebe4eee5a21cee88ad525b53b09c968d9b63 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 28 Mar 2024 11:37:04 +0000 Subject: [PATCH 1/3] Documents `doesntExpectOutput` --- console-tests.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/console-tests.md b/console-tests.md index 98c8f59a601..613f022d224 100644 --- a/console-tests.md +++ b/console-tests.md @@ -90,6 +90,28 @@ public function test_console_command(): void } ``` +You can also assert that a console command does not generate any output by 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 @@ -113,6 +135,8 @@ If your command displays a table of information using Artisan's `table` method, [2, 'abigail@example.com'], ]); +#### + ## Console Events From 65a7795297ccb036db7a07eca8876dc7871bd55c Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 28 Mar 2024 13:06:08 +0000 Subject: [PATCH 2/3] Update console-tests.md --- console-tests.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/console-tests.md b/console-tests.md index 613f022d224..87bf75bc6c3 100644 --- a/console-tests.md +++ b/console-tests.md @@ -135,8 +135,6 @@ If your command displays a table of information using Artisan's `table` method, [2, 'abigail@example.com'], ]); -#### - ## Console Events From ad37f430b044e32fa827cd0ec6c783f3432a3ce8 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 2 Apr 2024 08:42:41 -0500 Subject: [PATCH 3/3] Update console-tests.md --- console-tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console-tests.md b/console-tests.md index 87bf75bc6c3..8ae16b7ceef 100644 --- a/console-tests.md +++ b/console-tests.md @@ -90,7 +90,7 @@ public function test_console_command(): void } ``` -You can also assert that a console command does not generate any output by using the `doesntExpectOutput` method: +You may also assert that a console command does not generate any output using the `doesntExpectOutput` method: ```php tab=Pest test('console command', function () {