trait InteractsWithConsole

Properties

bool $mockConsoleOutput

Indicates if the console output should be mocked.

bool|null $expectsOutput

Indicates if the command is expected to output anything.

array $expectedOutput

All of the expected output lines.

array $expectedOutputSubstrings

All of the expected text to be present in the output.

array $unexpectedOutput

All of the output lines that aren't expected to be displayed.

array $unexpectedOutputSubstrings

All of the text that is not expected to be present in the output.

array $expectedQuestions

All of the expected questions.

array $expectedChoices

All of the expected choice questions.

Methods

artisan(string $command, array $parameters = [])

Invoke an Artisan command and return a mocked pending command or exit code.

mockArtisan(string $command, array $parameters = [])

Invoke an Artisan command and return a mocked pending command.

int
realArtisan(string $command, array $parameters = [])

Invoke an Artisan command and return the exit code.

withoutMockingConsoleOutput()

Disable mocking the console output.

Details

at line 55
int|PendingCommand artisan(string $command, array $parameters = [])

Invoke an Artisan command and return a mocked pending command or exit code.

Parameters

string $command
array $parameters

Return Value

int|PendingCommand

at line 65
PendingCommand mockArtisan(string $command, array $parameters = [])

Invoke an Artisan command and return a mocked pending command.

Parameters

string $command
array $parameters

Return Value

PendingCommand

at line 73
int realArtisan(string $command, array $parameters = [])

Invoke an Artisan command and return the exit code.

Parameters

string $command
array $parameters

Return Value

int

at line 88
protected InteractsWithConsole withoutMockingConsoleOutput()

Disable mocking the console output.

When using this with traits like DatabaseMigrations, call this in setUp() before parent::setUp() to ensure mock output is never bound.

Return Value

InteractsWithConsole