From 346e8412aa2a14d6cc8e06cbb05fab2d3ca93ec0 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Sat, 3 May 2025 15:30:58 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20deprecate=20assertSelec?= =?UTF-8?q?torCounts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 6 ++++-- src/Test/WebTestCase.php | 4 +++- tests/Test/WebTestCaseTest.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 18f5ee9..8881638 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,7 +10,7 @@ jobs: name: PHPStan steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: PHPStan uses: docker://oskarstark/phpstan-ga env: @@ -22,9 +22,11 @@ jobs: name: PHP-CS-Fixer steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Fix CS uses: docker://oskarstark/php-cs-fixer-ga + with: + args: --diff --dry-run tests: runs-on: ubuntu-24.04 strategy: diff --git a/src/Test/WebTestCase.php b/src/Test/WebTestCase.php index e3e680d..e7a58e4 100644 --- a/src/Test/WebTestCase.php +++ b/src/Test/WebTestCase.php @@ -249,7 +249,9 @@ protected static function submitFormByData( protected static function assertSelectorCounts(int $number, string $selector, string $message = ''): void { - self::assertCount($number, self::$client->getCrawler()->filter($selector), $message); + @\trigger_error(\sprintf('%s is deprecated since version %s, use self::assertSelectorCount instead.', __METHOD__, '7.1'), \E_USER_DEPRECATED); + + self::assertSelectorCount($number, $selector, $message); } protected static function tickCheckboxes(Form $form, array $checkboxValues = []): void diff --git a/tests/Test/WebTestCaseTest.php b/tests/Test/WebTestCaseTest.php index 78da6fb..cfd89d2 100644 --- a/tests/Test/WebTestCaseTest.php +++ b/tests/Test/WebTestCaseTest.php @@ -74,7 +74,7 @@ function (string $parameter): string { $method = new \ReflectionMethod(self::$mock, 'saveOutput'); $method->invoke(self::$mock, false); - /** @var \org\bovigo\vfs\vfsStreamFile $file */ + /** @var \org\bovigo\vfs\vfsStreamFile|null $file */ $file = $vfs->getChild('public/test.html'); self::assertNotNull($file); self::assertEquals('Response content', $file->getContent());