From 7ef40760c25bf8a33d7afecc2bf5f1945fda34b2 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 12 Aug 2024 00:46:31 +0100 Subject: [PATCH] fixes filter --- overrides/Runner/Filter/NameFilterIterator.php | 7 ++++++- src/Pest.php | 2 +- tests/.snapshots/success.txt | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/overrides/Runner/Filter/NameFilterIterator.php b/overrides/Runner/Filter/NameFilterIterator.php index 597f6e74..c637cc60 100644 --- a/overrides/Runner/Filter/NameFilterIterator.php +++ b/overrides/Runner/Filter/NameFilterIterator.php @@ -45,6 +45,7 @@ declare(strict_types=1); namespace PHPUnit\Runner\Filter; +use Pest\Contracts\HasPrintableTestCaseName; use PHPUnit\Framework\Test; use PHPUnit\Framework\TestSuite; use PHPUnit\Runner\PhptTestCase; @@ -97,7 +98,11 @@ abstract class NameFilterIterator extends RecursiveFilterIterator return false; } - $name = $test::class.'::'.$test->nameWithDataSet(); + if ($test instanceof HasPrintableTestCaseName) { + $name = $test::getPrintableTestCaseName().'::'.$test->getPrintableTestCaseMethodName(); + } else { + $name = $test::class.'::'.$test->nameWithDataSet(); + } $accepted = @preg_match($this->regularExpression, $name, $matches) === 1; diff --git a/src/Pest.php b/src/Pest.php index f278487b..975d3571 100644 --- a/src/Pest.php +++ b/src/Pest.php @@ -6,7 +6,7 @@ namespace Pest; function version(): string { - return '3.0.0-beta-2'; + return '3.0.0-beta-3'; } function testDirectory(string $file = ''): string diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 5794d90f..71b5ef5a 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -1076,8 +1076,8 @@ ! a "describe" group of tests → notice → This is a notice description // tests/Features/Notices.php:11 PASS Tests\Features\Pr - ✓ it may be associated with an pr #2 - ✓ nested → it may be associated with an pr #3 + ✓ it may be associated with an pr #1, #2 + ✓ nested → it may be associated with an pr #1, #4, #5, #6, #3 // an note between an the pr PASS Tests\Features\Repeat