Skip to content

Commit a014db1

Browse files
committed
Use correct class names in constraint tests
1 parent 78582ea commit a014db1

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

tests/unit/Codeception/Constraints/CrawlerConstraintTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22

33
declare(strict_types=1);
44

5-
use Codeception\PHPUnit\Constraint\Crawler;
5+
use Codeception\Constraint\Crawler as CrawlerConstraint;
66
use Codeception\PHPUnit\TestCase;
77
use PHPUnit\Framework\AssertionFailedError;
8+
use Symfony\Component\DomCrawler\Crawler as DomCrawler;
89

910
final class CrawlerConstraintTest extends TestCase
1011
{
11-
protected ?Crawler $constraint = null;
12+
protected ?CrawlerConstraint $constraint = null;
1213

1314
public function _setUp()
1415
{
15-
$this->constraint = new Codeception\PHPUnit\Constraint\Crawler('hello', '/user');
16+
$this->constraint = new CrawlerConstraint('hello', '/user');
1617
}
1718

1819
public function testEvaluation()
1920
{
20-
$nodes = new Symfony\Component\DomCrawler\Crawler("<p>Bye world</p><p>Hello world</p>");
21+
$nodes = new DomCrawler("<p>Bye world</p><p>Hello world</p>");
2122
$this->constraint->evaluate($nodes);
2223
}
2324

2425
public function testFailMessageResponse()
2526
{
26-
$nodes = new Symfony\Component\DomCrawler\Crawler('<p>Bye world</p><p>Bye warcraft</p>');
27+
$nodes = new DomCrawler('<p>Bye world</p><p>Bye warcraft</p>');
2728
try {
2829
$this->constraint->evaluate($nodes->filter('p'), 'selector');
2930
} catch (AssertionFailedError $fail) {
@@ -46,7 +47,7 @@ public function testFailMessageResponseWhenMoreNodes()
4647
$html .= "<p>item {$i}</p>";
4748
}
4849

49-
$nodes = new Symfony\Component\DomCrawler\Crawler($html);
50+
$nodes = new DomCrawler($html);
5051
try {
5152
$this->constraint->evaluate($nodes->filter('p'), 'selector');
5253
} catch (AssertionFailedError $fail) {
@@ -65,8 +66,8 @@ public function testFailMessageResponseWhenMoreNodes()
6566

6667
public function testFailMessageResponseWithoutUrl()
6768
{
68-
$this->constraint = new Codeception\PHPUnit\Constraint\Crawler('hello');
69-
$nodes = new Symfony\Component\DomCrawler\Crawler('<p>Bye world</p><p>Bye warcraft</p>');
69+
$this->constraint = new CrawlerConstraint('hello');
70+
$nodes = new DomCrawler('<p>Bye world</p><p>Bye warcraft</p>');
7071
try {
7172
$this->constraint->evaluate($nodes->filter('p'), 'selector');
7273
} catch (AssertionFailedError $fail) {

tests/unit/Codeception/Constraints/CrawlerNotConstraintTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22

33
declare(strict_types=1);
44

5-
use Codeception\PHPUnit\Constraint\CrawlerNot;
5+
use Codeception\Constraint\CrawlerNot as CrawlerNotConstraint;
66
use Codeception\PHPUnit\TestCase;
77
use PHPUnit\Framework\AssertionFailedError;
8+
use Symfony\Component\DomCrawler\Crawler as DomCrawler;
89

910
final class CrawlerNotConstraintTest extends TestCase
1011
{
11-
protected ?CrawlerNot $constraint = null;
12+
protected ?CrawlerNotConstraint $constraint = null;
1213

1314
public function _setUp()
1415
{
15-
$this->constraint = new Codeception\PHPUnit\Constraint\CrawlerNot('warcraft', '/user');
16+
$this->constraint = new CrawlerNotConstraint('warcraft', '/user');
1617
}
1718

1819
public function testEvaluation()
1920
{
20-
$nodes = new Symfony\Component\DomCrawler\Crawler("<p>Bye world</p><p>Hello world</p>");
21+
$nodes = new DomCrawler("<p>Bye world</p><p>Hello world</p>");
2122
$this->constraint->evaluate($nodes);
2223
}
2324

2425
public function testFailMessageResponse()
2526
{
26-
$nodes = new Symfony\Component\DomCrawler\Crawler('<p>Bye world</p><p>Bye warcraft</p>');
27+
$nodes = new DomCrawler('<p>Bye world</p><p>Bye warcraft</p>');
2728
try {
2829
$this->constraint->evaluate($nodes->filter('p'), 'selector');
2930
} catch (AssertionFailedError $fail) {
@@ -43,7 +44,7 @@ public function testFailMessageResponseWhenMoreNodes()
4344
$html .= "<p>warcraft {$i}</p>";
4445
}
4546

46-
$nodes = new Symfony\Component\DomCrawler\Crawler($html);
47+
$nodes = new DomCrawler($html);
4748
try {
4849
$this->constraint->evaluate($nodes->filter('p'), 'selector');
4950
} catch (AssertionFailedError $fail) {
@@ -58,8 +59,8 @@ public function testFailMessageResponseWhenMoreNodes()
5859

5960
public function testFailMessageResponseWithoutUrl()
6061
{
61-
$this->constraint = new Codeception\PHPUnit\Constraint\CrawlerNot('warcraft');
62-
$nodes = new Symfony\Component\DomCrawler\Crawler('<p>Bye world</p><p>Bye warcraft</p>');
62+
$this->constraint = new CrawlerNotConstraint('warcraft');
63+
$nodes = new DomCrawler('<p>Bye world</p><p>Bye warcraft</p>');
6364
try {
6465
$this->constraint->evaluate($nodes->filter('p'), 'selector');
6566
} catch (AssertionFailedError $fail) {

0 commit comments

Comments
 (0)