class TestView implements Stringable

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected View $view

The original view.

protected string $rendered

The rendered view contents.

Methods

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

__construct(View $view)

Create a new test view instance.

assertViewHas(string|array $key, mixed $value = null)

Assert that the response view has a given piece of bound data.

assertViewHasAll(array $bindings)

Assert that the response view has a given list of bound data.

assertViewMissing(string $key)

Assert that the response view is missing a piece of bound data.

assertViewEmpty()

Assert that the view's rendered content is empty.

assertSee(string $value, bool $escape = true)

Assert that the given string is contained within the view.

assertSeeInOrder(array $values, bool $escape = true)

Assert that the given strings are contained in order within the view.

assertSeeText(string $value, bool $escape = true)

Assert that the given string is contained within the view text.

assertSeeTextInOrder(array $values, bool $escape = true)

Assert that the given strings are contained in order within the view text.

assertDontSee(string $value, bool $escape = true)

Assert that the given string is not contained within the view.

assertDontSeeText(string $value, bool $escape = true)

Assert that the given string is not contained within the view text.

static void
flushState()

Flush all static state.

string
__toString()

Get the string contents of the rendered view.

Details

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.

Parameters

string $name
callable|object $macro

Return Value

void

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.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

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.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 103
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 34
__construct(View $view)

Create a new test view instance.

Parameters

View $view

at line 45
TestView assertViewHas(string|array $key, mixed $value = null)

Assert that the response view has a given piece of bound data.

Parameters

string|array $key
mixed $value

Return Value

TestView

at line 76
TestView assertViewHasAll(array $bindings)

Assert that the response view has a given list of bound data.

Parameters

array $bindings

Return Value

TestView

at line 94
TestView assertViewMissing(string $key)

Assert that the response view is missing a piece of bound data.

Parameters

string $key

Return Value

TestView

at line 106
TestView assertViewEmpty()

Assert that the view's rendered content is empty.

Return Value

TestView

at line 118
TestView assertSee(string $value, bool $escape = true)

Assert that the given string is contained within the view.

Parameters

string $value
bool $escape

Return Value

TestView

at line 132
TestView assertSeeInOrder(array $values, bool $escape = true)

Assert that the given strings are contained in order within the view.

Parameters

array $values
bool $escape

Return Value

TestView

at line 146
TestView assertSeeText(string $value, bool $escape = true)

Assert that the given string is contained within the view text.

Parameters

string $value
bool $escape

Return Value

TestView

at line 160
TestView assertSeeTextInOrder(array $values, bool $escape = true)

Assert that the given strings are contained in order within the view text.

Parameters

array $values
bool $escape

Return Value

TestView

at line 174
TestView assertDontSee(string $value, bool $escape = true)

Assert that the given string is not contained within the view.

Parameters

string $value
bool $escape

Return Value

TestView

at line 188
TestView assertDontSeeText(string $value, bool $escape = true)

Assert that the given string is not contained within the view text.

Parameters

string $value
bool $escape

Return Value

TestView

at line 200
static void flushState()

Flush all static state.

Return Value

void

at line 208
string __toString()

Get the string contents of the rendered view.

Return Value

string