Copied!

Eases the testing of console commands.

CloneableInstantiable
Methods
public __construct(Symfony\Component\Console\Command\Command $command)
public assertCommandIsSuccessful(string $message = '') : void
public execute(array $input, array $options = []) : int
 

Executes the command.

Available execution options:

  • interactive: Sets the input interactive flag
  • decorated: Sets the output decorated flag
  • verbosity: Sets the output verbosity flag
  • capture_stderr_separately: Make output of stdOut and stdErr separately available
  • param array $input An array of command arguments and options
  • param array $options An array of execution options
  • return int The command exit code
public getDisplay(bool $normalize = false) : string
 

Gets the display returned by the last execution of the command or application.

  • throws \RuntimeException If it's called before the execute method
public getErrorOutput(bool $normalize = false) : string
 

Gets the output written to STDERR by the application.

  • param bool $normalize Whether to normalize end of lines to \n or not
public getInput() : Symfony\Component\Console\Input\InputInterface
 

Gets the input instance used by the last execution of the command or application.

public getOutput() : Symfony\Component\Console\Output\OutputInterface
 

Gets the output instance used by the last execution of the command or application.

public getStatusCode() : int
 

Gets the status code returned by the last execution of the command or application.

  • throws \RuntimeException If it's called before the execute method
public setInputs(array $inputs) : static
 

Sets the user inputs.

  • param array $inputs An array of strings representing each input passed to the command input stream
  • return $this
Properties
private bool $captureStreamsIndependently = false
private Symfony\Component\Console\Command\Command $command
private Symfony\Component\Console\Input\InputInterface $input
private array $inputs = []
private Symfony\Component\Console\Output\StreamOutput $output
private int $statusCode
Methods
private static createStream(array $inputs)
 
  • return resource
private initOutput(array $options) : void
 

Initializes the output property.

Available options:

  • decorated: Sets the output decorated flag
  • verbosity: Sets the output verbosity flag
  • capture_stderr_separately: Make output of stdOut and stdErr separately available
Methods
private static createStream(array $inputs)
 
  • return resource
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration