class TestView implements Stringable (View source)

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, object|callable $macro)

Register a custom macro.

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

Mix another object into the class.

static bool
hasMacro(string $name)

Checks 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.

void
__construct(View $view)

Create a new test view instance.

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

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

$this
assertViewHasAll(array $bindings)

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

$this
assertViewMissing(string $key)

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

$this
assertViewEmpty()

Assert that the view's rendered content is empty.

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

Assert that the given string is contained within the view.

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

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

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

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

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

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

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

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

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

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

string
__toString()

Get the string contents of the rendered view.

Details

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

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

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

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static void flushMacros()

Flush the existing macros.

Return Value

void

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

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

void __construct(View $view)

Create a new test view instance.

Parameters

View $view

Return Value

void

$this 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

$this

$this assertViewHasAll(array $bindings)

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

Parameters

array $bindings

Return Value

$this

$this assertViewMissing(string $key)

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

Parameters

string $key

Return Value

$this

$this assertViewEmpty()

Assert that the view's rendered content is empty.

Return Value

$this

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

Assert that the given string is contained within the view.

Parameters

string $value
bool $escape

Return Value

$this

$this 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

$this

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

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

Parameters

string $value
bool $escape

Return Value

$this

$this 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

$this

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

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

Parameters

string $value
bool $escape

Return Value

$this

$this 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

$this

string __toString()

Get the string contents of the rendered view.

Return Value

string