class TestComponent implements Stringable

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
Component $component

The original component.

protected string $rendered

The rendered component 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 call methods on the underlying component.

__construct(Component $component, View $view)

Create a new test component instance.

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

Assert that the given string is contained within the rendered component.

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

Assert that the given strings are contained in order within the rendered component.

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

Assert that the given string is contained within the rendered component text.

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

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

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

Assert that the given string is not contained within the rendered component.

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

Assert that the given string is not contained within the rendered component text.

static void
flushState()

Flush all static state.

string
__toString()

Get the string contents of the rendered component.

mixed
__get(string $attribute)

Dynamically access properties on the underlying component.

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

at line 151
mixed __call(string $method, array $parameters)

Dynamically call methods on the underlying component.

Parameters

string $method
array $parameters

Return Value

mixed

at line 33
__construct(Component $component, View $view)

Create a new test component instance.

Parameters

Component $component
View $view

at line 45
TestComponent assertSee(string $value, bool $escape = true)

Assert that the given string is contained within the rendered component.

Parameters

string $value
bool $escape

Return Value

TestComponent

at line 59
TestComponent assertSeeInOrder(array $values, bool $escape = true)

Assert that the given strings are contained in order within the rendered component.

Parameters

array $values
bool $escape

Return Value

TestComponent

at line 73
TestComponent assertSeeText(string $value, bool $escape = true)

Assert that the given string is contained within the rendered component text.

Parameters

string $value
bool $escape

Return Value

TestComponent

at line 87
TestComponent assertSeeTextInOrder(array $values, bool $escape = true)

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

Parameters

array $values
bool $escape

Return Value

TestComponent

at line 101
TestComponent assertDontSee(string $value, bool $escape = true)

Assert that the given string is not contained within the rendered component.

Parameters

string $value
bool $escape

Return Value

TestComponent

at line 115
TestComponent assertDontSeeText(string $value, bool $escape = true)

Assert that the given string is not contained within the rendered component text.

Parameters

string $value
bool $escape

Return Value

TestComponent

at line 127
static void flushState()

Flush all static state.

Return Value

void

at line 135
string __toString()

Get the string contents of the rendered component.

Return Value

string

at line 143
mixed __get(string $attribute)

Dynamically access properties on the underlying component.

Parameters

string $attribute

Return Value

mixed