trait FakesInputOutput

Methods

static void
fake(array $keys = [])

Fake the terminal and queue key presses to be simulated.

static void
fakeKeyPresses(array $keys, callable $callable)

Implementation of the looping mechanism for simulating key presses.

static void
assertOutputContains(string $string)

Assert that the output contains the given string.

static void
assertOutputDoesntContain(string $string)

Assert that the output doesn't contain the given string.

static void
assertStrippedOutputContains(string $string)

Assert that the stripped output contains the given string.

static void
assertStrippedOutputDoesntContain(string $string)

Assert that the stripped output doesn't contain the given string.

static string
content()

Get the buffered console output.

static string
strippedContent()

Get the buffered console output, stripped of escape sequences.

Details

at line 23
static void fake(array $keys = [])

Fake the terminal and queue key presses to be simulated.

Tests only. Swaps prompt terminal and output state for the worker lifetime.

Parameters

array $keys

Return Value

void

at line 60
static void fakeKeyPresses(array $keys, callable $callable)

Implementation of the looping mechanism for simulating key presses.

By ignoring the $callable parameter which contains the default logic for simulating fake key presses, we can use a custom implementation to emit key presses instead, allowing us to use different inputs.

Parameters

array $keys
callable $callable

Return Value

void

at line 70
static void assertOutputContains(string $string)

Assert that the output contains the given string.

Parameters

string $string

Return Value

void

at line 78
static void assertOutputDoesntContain(string $string)

Assert that the output doesn't contain the given string.

Parameters

string $string

Return Value

void

at line 86
static void assertStrippedOutputContains(string $string)

Assert that the stripped output contains the given string.

Parameters

string $string

Return Value

void

at line 94
static void assertStrippedOutputDoesntContain(string $string)

Assert that the stripped output doesn't contain the given string.

Parameters

string $string

Return Value

void

at line 102
static string content()

Get the buffered console output.

Return Value

string

at line 114
static string strippedContent()

Get the buffered console output, stripped of escape sequences.

Return Value

string