123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace Symfony\Component\DomCrawler\Test\Constraint;
- use PHPUnit\Framework\Constraint\Constraint;
- use Symfony\Component\DomCrawler\Crawler;
- final class CrawlerSelectorExists extends Constraint
- {
- private $selector;
- public function __construct(string $selector)
- {
- $this->selector = $selector;
- }
-
- public function toString(): string
- {
- return sprintf('matches selector "%s"', $this->selector);
- }
-
- protected function matches($crawler): bool
- {
- return 0 < \count($crawler->filter($this->selector));
- }
-
- protected function failureDescription($crawler): string
- {
- return 'the Crawler '.$this->toString();
- }
- }
|