package and depencies
This commit is contained in:
@@ -16,9 +16,9 @@ use Symfony\Component\DomCrawler\Crawler;
|
||||
|
||||
final class CrawlerSelectorAttributeValueSame extends Constraint
|
||||
{
|
||||
private $selector;
|
||||
private $attribute;
|
||||
private $expectedText;
|
||||
private string $selector;
|
||||
private string $attribute;
|
||||
private string $expectedText;
|
||||
|
||||
public function __construct(string $selector, string $attribute, string $expectedText)
|
||||
{
|
||||
@@ -27,9 +27,6 @@ final class CrawlerSelectorAttributeValueSame extends Constraint
|
||||
$this->expectedText = $expectedText;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf('has a node matching selector "%s" with attribute "%s" of value "%s"', $this->selector, $this->attribute, $this->expectedText);
|
||||
@@ -37,8 +34,6 @@ final class CrawlerSelectorAttributeValueSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Crawler $crawler
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($crawler): bool
|
||||
{
|
||||
@@ -52,8 +47,6 @@ final class CrawlerSelectorAttributeValueSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Crawler $crawler
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($crawler): string
|
||||
{
|
||||
|
@@ -16,16 +16,13 @@ use Symfony\Component\DomCrawler\Crawler;
|
||||
|
||||
final class CrawlerSelectorExists extends Constraint
|
||||
{
|
||||
private $selector;
|
||||
private string $selector;
|
||||
|
||||
public function __construct(string $selector)
|
||||
{
|
||||
$this->selector = $selector;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf('matches selector "%s"', $this->selector);
|
||||
@@ -33,8 +30,6 @@ final class CrawlerSelectorExists extends Constraint
|
||||
|
||||
/**
|
||||
* @param Crawler $crawler
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($crawler): bool
|
||||
{
|
||||
@@ -43,8 +38,6 @@ final class CrawlerSelectorExists extends Constraint
|
||||
|
||||
/**
|
||||
* @param Crawler $crawler
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($crawler): string
|
||||
{
|
||||
|
@@ -16,10 +16,10 @@ use Symfony\Component\DomCrawler\Crawler;
|
||||
|
||||
final class CrawlerSelectorTextContains extends Constraint
|
||||
{
|
||||
private $selector;
|
||||
private $expectedText;
|
||||
private $hasNode = false;
|
||||
private $nodeText;
|
||||
private string $selector;
|
||||
private string $expectedText;
|
||||
private bool $hasNode = false;
|
||||
private string $nodeText;
|
||||
|
||||
public function __construct(string $selector, string $expectedText)
|
||||
{
|
||||
@@ -27,9 +27,6 @@ final class CrawlerSelectorTextContains extends Constraint
|
||||
$this->expectedText = $expectedText;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
if ($this->hasNode) {
|
||||
@@ -41,8 +38,6 @@ final class CrawlerSelectorTextContains extends Constraint
|
||||
|
||||
/**
|
||||
* @param Crawler $crawler
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($crawler): bool
|
||||
{
|
||||
@@ -56,13 +51,11 @@ final class CrawlerSelectorTextContains extends Constraint
|
||||
$this->hasNode = true;
|
||||
$this->nodeText = $crawler->text(null, true);
|
||||
|
||||
return false !== mb_strpos($this->nodeText, $this->expectedText);
|
||||
return str_contains($this->nodeText, $this->expectedText);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Crawler $crawler
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($crawler): string
|
||||
{
|
||||
|
@@ -16,8 +16,8 @@ use Symfony\Component\DomCrawler\Crawler;
|
||||
|
||||
final class CrawlerSelectorTextSame extends Constraint
|
||||
{
|
||||
private $selector;
|
||||
private $expectedText;
|
||||
private string $selector;
|
||||
private string $expectedText;
|
||||
|
||||
public function __construct(string $selector, string $expectedText)
|
||||
{
|
||||
@@ -25,9 +25,6 @@ final class CrawlerSelectorTextSame extends Constraint
|
||||
$this->expectedText = $expectedText;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf('has a node matching selector "%s" with content "%s"', $this->selector, $this->expectedText);
|
||||
@@ -35,8 +32,6 @@ final class CrawlerSelectorTextSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Crawler $crawler
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function matches($crawler): bool
|
||||
{
|
||||
@@ -50,8 +45,6 @@ final class CrawlerSelectorTextSame extends Constraint
|
||||
|
||||
/**
|
||||
* @param Crawler $crawler
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function failureDescription($crawler): string
|
||||
{
|
||||
|
Reference in New Issue
Block a user