HasValue

class HasValue extends FormFieldConstraint (View source)

Properties

protected string $selector The name or ID of the element. from FormFieldConstraint
protected string $value The expected value. from FormFieldConstraint

Methods

string html(Crawler|string $crawler)

Make sure we obtain the HTML from the crawler or the response.

from PageConstraint
string text(Crawler|string $crawler)

Make sure we obtain the HTML from the crawler or the response.

from PageConstraint
Crawler crawler(Crawler|string $crawler)

Create a crawler instance if the given value is not already a Crawler.

from PageConstraint
string getEscapedPattern(string $text)

Get the escaped text pattern for the constraint.

from PageConstraint
void fail(Crawler|string $crawler, string $description, ComparisonFailure $comparisonFailure = null)

Throw an exception for the given comparison and test description.

from PageConstraint
string getFailureDescription()

Return the description of the failure.

string toString()

Get a string representation of the object.

from PageConstraint
void __construct(string $selector, mixed $value)

Create a new constraint instance.

from FormFieldConstraint
string validElements()

Get the valid elements.

Crawler field(Crawler $crawler)

Get the form field.

from FormFieldConstraint
array getElements()

Get the elements relevant to the selector.

from FormFieldConstraint
bool matches(Crawler|string $crawler)

Check if the input contains the expected value.

string getInputOrTextAreaValue(Crawler $crawler)

Get the value of an input or textarea.

Details

protected string html(Crawler|string $crawler)

Make sure we obtain the HTML from the crawler or the response.

Parameters

Crawler|string $crawler

Return Value

string

protected string text(Crawler|string $crawler)

Make sure we obtain the HTML from the crawler or the response.

Parameters

Crawler|string $crawler

Return Value

string

protected Crawler crawler(Crawler|string $crawler)

Create a crawler instance if the given value is not already a Crawler.

Parameters

Crawler|string $crawler

Return Value

Crawler

protected string getEscapedPattern(string $text)

Get the escaped text pattern for the constraint.

Parameters

string $text

Return Value

string

protected void fail(Crawler|string $crawler, string $description, ComparisonFailure $comparisonFailure = null)

Throw an exception for the given comparison and test description.

Parameters

Crawler|string $crawler
string $description
ComparisonFailure $comparisonFailure

Return Value

void

Exceptions

PHPUnit_Framework_ExpectationFailedException

protected string getFailureDescription()

Return the description of the failure.

Return Value

string

string toString()

Get a string representation of the object.

Placeholder method to avoid forcing definition of this method.

Return Value

string

void __construct(string $selector, mixed $value)

Create a new constraint instance.

Parameters

string $selector
mixed $value

Return Value

void

protected string validElements()

Get the valid elements.

Return Value

string

protected Crawler field(Crawler $crawler)

Get the form field.

Parameters

Crawler $crawler

Return Value

Crawler

Exceptions

PHPUnit_Framework_ExpectationFailedException

protected array getElements()

Get the elements relevant to the selector.

Return Value

array

bool matches(Crawler|string $crawler)

Check if the input contains the expected value.

Parameters

Crawler|string $crawler

Return Value

bool

string getInputOrTextAreaValue(Crawler $crawler)

Get the value of an input or textarea.

Parameters

Crawler $crawler

Return Value

string

Exceptions

PHPUnit_Framework_ExpectationFailedException

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.2/Illuminate/Foundation/Testing/Constraints/HasValue.html