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.
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 15
mixed
tap(callable|null $callback = null)
Call the given Closure with this instance then return the instance.
at line 57
__construct(TestCase $test, Container $app, string $command, array $parameters)
Create a new pending console command run.
at line 68
PendingCommand
expectsQuestion(string $question, array|bool|string $answer)
Specify an expected question that will be asked when the command runs.
at line 78
PendingCommand
expectsConfirmation(string $question, string $answer = 'no')
Specify an expected confirmation question that will be asked when the command runs.
at line 86
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 99
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 109
PendingCommand
expectsOutput(string|null $output = null)
Specify output that should be printed when the command runs.
at line 125
PendingCommand
doesntExpectOutput(string|null $output = null)
Specify output that should never be printed when the command runs.
at line 141
PendingCommand
expectsOutputToContain(string $string)
Specify that the given string should be contained in the command output.
at line 151
PendingCommand
doesntExpectOutputToContain(string $string)
Specify that the given string shouldn't be contained in the command output.
at line 161
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 188
PendingCommand
expectsPromptsInfo(string $message)
Specify that the given Prompts info message should be contained in the command output.
at line 200
PendingCommand
expectsPromptsWarning(string $message)
Specify that the given Prompts warning message should be contained in the command output.
at line 212
PendingCommand
expectsPromptsError(string $message)
Specify that the given Prompts error message should be contained in the command output.
at line 224
PendingCommand
expectsPromptsAlert(string $message)
Specify that the given Prompts alert message should be contained in the command output.
at line 236
PendingCommand
expectsPromptsIntro(string $message)
Specify that the given Prompts intro message should be contained in the command output.
at line 248
PendingCommand
expectsPromptsOutro(string $message)
Specify that the given Prompts outro message should be contained in the command output.
at line 265
PendingCommand
expectsPromptsTable(array|Collection $headers, array|Collection|null $rows)
Specify a Prompts table that should be printed when the command runs.
at line 277
protected void
expectOutputToContainPrompt(Prompt $prompt)
Render the given prompt and add the output to the expectations.
at line 290
PendingCommand
assertExitCode(int $exitCode)
Assert that the command has the given exit code.
at line 300
PendingCommand
assertNotExitCode(int $exitCode)
Assert that the command does not have the given exit code.
at line 310
PendingCommand
assertSuccessful()
Assert that the command has the success exit code.
at line 318
PendingCommand
assertOk()
Assert that the command has the success exit code.
at line 326
PendingCommand
assertFailed()
Assert that the command does not have the success exit code.
at line 334
int
execute()
Execute the command.
at line 344
int
run()
Execute the command.
at line 389
protected void
verifyExpectations()
Determine if expected questions / choices / outputs are fulfilled.
at line 427
protected
mockConsoleOutput()
Mock the application's console output.
at line 540
protected void
flushExpectations()
Flush the expectations from the test case.
at line 554
static void
flushState()
Flush all static state.
at line 562
__destruct()
Handle the object's destruction.