Skip to content

Commit

Permalink
[11.x] Documents doesntExpectOutput (#9541)
Browse files Browse the repository at this point in the history
* Documents `doesntExpectOutput`

* Update console-tests.md

* Update console-tests.md

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
nunomaduro and taylorotwell authored Apr 2, 2024
1 parent 7ae837a commit 6468971
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions console-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
```

<a name="confirmation-expectations"></a>
#### Confirmation Expectations

Expand Down

0 comments on commit 6468971

Please sign in to comment.