PendingCommand
class PendingCommand
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected int|null | $expectedExitCode | The expected exit code. |
|
| protected int|null | $unexpectedExitCode | The unexpected exit code. |
|
| protected bool | $hasExecuted | Determine if the command has executed. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Call the given Closure with this instance then return the instance.
Create a new pending console command run.
Specify an expected question that will be asked when the command runs.
Specify an expected confirmation question that will be asked when the command runs.
Specify an expected choice question with expected answers that will be asked/shown when the command runs.
Specify an expected search question with an expected search string, followed by an expected choice question with expected answers.
Specify output that should be printed when the command runs.
Specify output that should never be printed when the command runs.
Specify that the given string should be contained in the command output.
Specify that the given string shouldn't be contained in the command output.
Specify a table that should be printed when the command runs.
Specify that the given Prompts info message should be contained in the command output.
Specify that the given Prompts warning message should be contained in the command output.
Specify that the given Prompts error message should be contained in the command output.
Specify that the given Prompts alert message should be contained in the command output.
Specify that the given Prompts intro message should be contained in the command output.
Specify that the given Prompts outro message should be contained in the command output.
Specify a Prompts table that should be printed when the command runs.
Render the given prompt and add the output to the expectations.
Assert that the command has the given exit code.
Assert that the command does not have the given exit code.
Assert that the command has the success exit code.
Assert that the command has the success exit code.
Assert that the command does not have the success exit code.
Execute the command.
Execute the command.
Debug the command.
Determine if expected questions / choices / outputs are fulfilled.
Mock the application's console output.
Flush the expectations from the test case.
Flush all static state.
Handle the object's destruction.
Details
in
Conditionable at line 23
mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
in
Conditionable at line 56
mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
Tappable at line 17
mixed
tap(callable|null $callback = null)
Call the given Closure with this instance then return the instance.
at line 60
__construct(TestCase $test, Container $app, string $command, array $parameters)
Create a new pending console command run.
at line 71
PendingCommand
expectsQuestion(string $question, mixed $answer)
Specify an expected question that will be asked when the command runs.
at line 81
PendingCommand
expectsConfirmation(string $question, string $answer = 'no')
Specify an expected confirmation question that will be asked when the command runs.
at line 89
PendingCommand
expectsChoice(string $question, array|string $answer, array $answers, bool $strict = false)
Specify an expected choice question with expected answers that will be asked/shown when the command runs.
at line 102
PendingCommand
expectsSearch(string $question, array|string $answer, string $search, array $answers)
Specify an expected search question with an expected search string, followed by an expected choice question with expected answers.
at line 112
PendingCommand
expectsOutput(string|null $output = null)
Specify output that should be printed when the command runs.
at line 128
PendingCommand
doesntExpectOutput(string|null $output = null)
Specify output that should never be printed when the command runs.
at line 144
PendingCommand
expectsOutputToContain(string $string)
Specify that the given string should be contained in the command output.
at line 154
PendingCommand
doesntExpectOutputToContain(string $string)
Specify that the given string shouldn't be contained in the command output.
at line 164
PendingCommand
expectsTable(array $headers, array|Arrayable $rows, string $tableStyle = 'default', array $columnStyles = [])
Specify a table that should be printed when the command runs.
at line 191
PendingCommand
expectsPromptsInfo(string $message)
Specify that the given Prompts info message should be contained in the command output.
at line 203
PendingCommand
expectsPromptsWarning(string $message)
Specify that the given Prompts warning message should be contained in the command output.
at line 215
PendingCommand
expectsPromptsError(string $message)
Specify that the given Prompts error message should be contained in the command output.
at line 227
PendingCommand
expectsPromptsAlert(string $message)
Specify that the given Prompts alert message should be contained in the command output.
at line 239
PendingCommand
expectsPromptsIntro(string $message)
Specify that the given Prompts intro message should be contained in the command output.
at line 251
PendingCommand
expectsPromptsOutro(string $message)
Specify that the given Prompts outro message should be contained in the command output.
at line 268
PendingCommand
expectsPromptsTable(array|Collection $headers, array|Collection|null $rows)
Specify a Prompts table that should be printed when the command runs.
at line 280
protected void
expectOutputToContainPrompt(Prompt $prompt)
Render the given prompt and add the output to the expectations.
at line 293
PendingCommand
assertExitCode(int $exitCode)
Assert that the command has the given exit code.
at line 303
PendingCommand
assertNotExitCode(int $exitCode)
Assert that the command does not have the given exit code.
at line 313
PendingCommand
assertSuccessful()
Assert that the command has the success exit code.
at line 321
PendingCommand
assertOk()
Assert that the command has the success exit code.
at line 329
PendingCommand
assertFailed()
Assert that the command does not have the success exit code.
at line 337
int
execute()
Execute the command.
at line 347
int
run()
Execute the command.
at line 395
never
dd()
Debug the command.
at line 414
protected void
verifyExpectations()
Determine if expected questions / choices / outputs are fulfilled.
at line 452
protected
mockConsoleOutput()
Mock the application's console output.
at line 569
protected void
flushExpectations()
Flush the expectations from the test case.
at line 583
static void
flushState()
Flush all static state.
at line 591
__destruct()
Handle the object's destruction.