HasLink
class HasLink extends PageConstraint (View source)
Properties
protected string | $text | The text expected to be found. | |
protected string|null | $url | The URL expected to be linked in the tag. |
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() Returns the description of the failure. | |
string | toString() Get a string representation of the object. | from PageConstraint |
void | __construct(string $text, string|null $url = null) Create a new constraint instance. | |
bool | matches(Crawler|string $crawler) Check if the link is found in the given crawler. | |
string | absoluteUrl() Add a root if the URL is relative (helper method of the hasLink function). |
Details
protected string html(Crawler|string $crawler)
Make sure we obtain the HTML from the crawler or the response.
protected string text(Crawler|string $crawler)
Make sure we obtain the HTML from the crawler or the response.
protected Crawler crawler(Crawler|string $crawler)
Create a crawler instance if the given value is not already a Crawler.
protected string getEscapedPattern(string $text)
Get the escaped text pattern for the constraint.
protected void fail(Crawler|string $crawler, string $description, ComparisonFailure $comparisonFailure = null)
Throw an exception for the given comparison and test description.
string getFailureDescription()
Returns the description of the failure.
string toString()
Get a string representation of the object.
Placeholder method to avoid forcing definition of this method.
void __construct(string $text, string|null $url = null)
Create a new constraint instance.
bool matches(Crawler|string $crawler)
Check if the link is found in the given crawler.
protected string absoluteUrl()
Add a root if the URL is relative (helper method of the hasLink function).
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.2/Illuminate/Foundation/Testing/Constraints/HasLink.html