8000 fix review: swap arguments · symfony/symfony@7440331 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7440331

Browse files
fix review: swap arguments
1 parent 6dfd800 commit 7440331

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Symfony/Bundle/FrameworkBundle/Test/DomCrawlerAssertionsTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public static function assertSelectorNotExists(string $selector, string $message
3535
self::assertThat(self::getCrawler(), new LogicalNot(new DomCrawlerConstraint\CrawlerSelectorExists($selector)), $message);
3636
}
3737

38-
public static function assertSelectorCount(string $selector, int $expectedCount, string $message = ''): void
38+
public static function assertSelectorCount(int $expectedCount, string $selector, string $message = ''): void
3939
{
40-
self::assertThat(self::getCrawler(), new DomCrawlerConstraint\CrawlerSelectorCount($selector, $expectedCount), $message);
40+
self::assertThat(self::getCrawler(), new DomCrawlerConstraint\CrawlerSelectorCount($expectedCount, $selector), $message);
4141
}
4242

4343
public static function assertSelectorTextContains(string $selector, string $text, string $message = ''): void

src/Symfony/Bundle/FrameworkBundle/Tests/Test/WebTestCaseTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ public function testAssertSelectorNotExists()
193193

194194
public function testAssertSelectorCount()
195195
{
196-
$this->getCrawlerTester(new Crawler('<html><body><p>Hello</p></body></html>'))->assertSelectorCount('p', 1);
197-
$this->getCrawlerTester(new Crawler('<html><body><p>Hello</p><p>Foo</p></body></html>'))->assertSelectorCount('p', 2);
198-
$this->getCrawlerTester(new Crawler('<html><body><h1>This is not a paragraph.</h1></body></html>'))->assertSelectorCount('p', 0);
196+
$this->getCrawlerTester(new Crawler('<html><body><p>Hello</p></body></html>'))->assertSelectorCount(1, 'p');
197+
$this->getCrawlerTester(new Crawler('<html><body><p>Hello</p><p>Foo</p></body></html>'))->assertSelectorCount(2, 'p');
198+
$this->getCrawlerTester(new Crawler('<html><body><h1>This is not a paragraph.</h1></body></html>'))->assertSelectorCount(0, 'p');
199199
$this->expectException(AssertionFailedError::class);
200200
$this->expectExceptionMessage('Failed asserting that the Crawler selector "p" was expected to be found 0 time(s) but was found 1 time(s).');
201-
$this->getCrawlerTester(new Crawler('<html><body><p>Hello</p></body></html>'))->assertSelectorCount('p', 0);
201+
$this->getCrawlerTester(new Crawler('<html><body><p>Hello</p></body></html>'))->assertSelectorCount(0, 'p');
202202
}
203203

204204
public function testAssertSelectorTextNotContains()

src/Symfony/Component/DomCrawler/Test/Constraint/CrawlerSelectorCount.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
final class CrawlerSelectorCount extends Constraint
1818
{
1919
public function __construct(
20+
private readonly int $count,
2021
private readonly string $selector,
21-
private readonly int $count
22-
){
22+
) {
2323
}
2424

2525
public function toString(): string

0 commit comments

Comments
 (0)
0