\Dewdrop\Cli\RendererMock

This class just stores everything passed to the renderer so that it can later be checked for certain patterns in order to test CLI commands.

Summary

Methods
Properties
Constants
title()
subhead()
text()
table()
success()
warn()
error()
newline()
unorderedList()
hasOutput()
ask()
secret()
select()
confirm()
No public properties found
No constants found
No protected methods found
$output
N/A
No private methods found
No private properties found
N/A

Properties

$output

$output : string

Output buffer used to allow testing of output during testing.

Type

string

Methods

title()

title(string  $title) 

Display the primary title for the output.

Parameters

string $title

subhead()

subhead(string  $subhead) 

Display a subhead, or 2nd-level header.

Parameters

string $subhead

text()

text(string  $text) 

Display a single line or block of text.

Parameters

string $text

table()

table(array  $rows) 

Display a table. The supplied array should have the row title as the keys and the descriptions as the array values.

Parameters

array $rows

success()

success(string  $message) 

Display a success message.

Parameters

string $message

warn()

warn(string  $warning) 

Display a warning message.

Parameters

string $warning

error()

error(string  $error) 

Display an error message.

Parameters

string $error

newline()

newline() 

Display a newline/line break.

unorderedList()

unorderedList(array  $items) : \Dewdrop\Cli\Renderer\RendererInterface

Display an unordered (bulleted) list.

Parameters

array $items

Returns

\Dewdrop\Cli\Renderer\RendererInterface

hasOutput()

hasOutput(string  $search) : boolean

Check whether the provided search string is present anywhere in the output buffer of this renderer. This can be useful for testing CLI commands.

Parameters

string $search

Returns

boolean

ask()

ask(  $promptText, boolean  $allowEmpty = false) : string

Ask the user for a line of input.

Parameters

$promptText
boolean $allowEmpty

Returns

string

secret()

secret(  $promptText, boolean  $allowEmpty = false) : string

Ask the user for a line of input and don't display that input as they're typing. Ideal for passwords, etc.

Parameters

$promptText
boolean $allowEmpty

Returns

string

select()

select(  $promptText, array  $options, boolean  $allowEmpty = false) : string

Request that the user select an option from a list.

Parameters

$promptText
array $options
boolean $allowEmpty

Returns

string

confirm()

confirm(  $promptText) : boolean

Ask the user to answer a yes/no confirmation prompt.

Parameters

$promptText

Returns

boolean