trait OutputUtilsTrait (View source)

OutputUtilsTrait provides some useful utility methods for test classes that define getOutputRaw() and getErrorOutputRaw() methods.

This trait is used by CliTestTrait and DrushTestTrait.

Methods

string
getOutputRaw()

Accessor for the last output, non-trimmed.

string
getErrorOutputRaw()

Accessor for the last stderr output, non-trimmed.

string
getSimplifiedOutput()

Get command output and simplify things like full paths and extra whitespace.

string
getSimplifiedErrorOutput()

Returns a simplified version of the error output to facilitate testing.

string
simplifyOutput(string $output)

Remove things like full paths and extra whitespace from the given string.

array
pathsToSimplify()

No description

string
getOutput()

Accessor for the last output, trimmed.

string
getErrorOutput()

Accessor for the last stderr output, trimmed.

array
getOutputAsList()

Accessor for the last output, rtrimmed and split on newlines.

array
getErrorOutputAsList()

Accessor for the last stderr output, rtrimmed and split on newlines.

mixed
getOutputFromJSON(string|int $key = null)

Accessor for the last output, decoded from json.

Details

abstract string getOutputRaw()

Accessor for the last output, non-trimmed.

Return Value

string

abstract string getErrorOutputRaw()

Accessor for the last stderr output, non-trimmed.

Return Value

string

protected string getSimplifiedOutput()

Get command output and simplify things like full paths and extra whitespace.

Return Value

string

protected string getSimplifiedErrorOutput()

Returns a simplified version of the error output to facilitate testing.

Return Value

string

A simplified version of the error output that has things like full paths and superfluous whitespace removed from it.

protected string simplifyOutput(string $output)

Remove things like full paths and extra whitespace from the given string.

Parameters

string $output

Return Value

string

array pathsToSimplify()

No description

Return Value

array

string getOutput()

Accessor for the last output, trimmed.

Return Value

string

string getErrorOutput()

Accessor for the last stderr output, trimmed.

Return Value

string

array getOutputAsList()

Accessor for the last output, rtrimmed and split on newlines.

Return Value

array

array getErrorOutputAsList()

Accessor for the last stderr output, rtrimmed and split on newlines.

Return Value

array

mixed getOutputFromJSON(string|int $key = null)

Accessor for the last output, decoded from json.

Parameters

string|int $key

Optionally return only a top level element from the json object.

Return Value

mixed