ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 3.147.28.206 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/funds/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ |
Upload File : |
<?php namespace Illuminate\Foundation\Testing\Constraints; use Illuminate\Support\Str; use Illuminate\Support\Facades\URL; class HasLink extends PageConstraint { /** * The text expected to be found. * * @var string */ protected $text; /** * The URL expected to be linked in the <a> tag. * * @var string|null */ protected $url; /** * Create a new constraint instance. * * @param string $text * @param string|null $url * @return void */ public function __construct($text, $url = null) { $this->url = $url; $this->text = $text; } /** * Check if the link is found in the given crawler. * * @param \Symfony\Component\DomCrawler\Crawler|string $crawler * @return bool */ public function matches($crawler) { $links = $this->crawler($crawler)->selectLink($this->text); if ($links->count() == 0) { return false; } // If the URL is null we assume the developer only wants to find a link // with the given text regardless of the URL. So if we find the link // we will return true. Otherwise, we will look for the given URL. if ($this->url == null) { return true; } $absoluteUrl = $this->absoluteUrl(); foreach ($links as $link) { $linkHref = $link->getAttribute('href'); if ($linkHref == $this->url || $linkHref == $absoluteUrl) { return true; } } return false; } /** * Add a root if the URL is relative (helper method of the hasLink function). * * @return string */ protected function absoluteUrl() { if (! Str::startsWith($this->url, ['http', 'https'])) { return URL::to($this->url); } return $this->url; } /** * Returns the description of the failure. * * @return string */ public function getFailureDescription() { $description = "a link with the text [{$this->text}]"; if ($this->url) { $description .= " and the URL [{$this->url}]"; } return $description; } }