diff --git a/composer.json b/composer.json index c288cc99..8c93f4af 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "phpunit/php-code-coverage": "^10.1.11 || ^11.0.0", "phpunit/php-file-iterator": "^4.1.0 || ^5.0.0", "phpunit/php-timer": "^6.0.0 || ^7.0.0", - "phpunit/phpunit": "^10.5.9 || ^11.0.2", + "phpunit/phpunit": "^10.5.9 || ^11.0.3", "sebastian/environment": "^6.0.1 || ^7.0.0", "symfony/console": "^6.4.3 || ^7.0.3", "symfony/process": "^6.4.3 || ^7.0.3" diff --git a/src/WrapperRunner/SuiteLoader.php b/src/WrapperRunner/SuiteLoader.php index e1636a0a..c14531ab 100644 --- a/src/WrapperRunner/SuiteLoader.php +++ b/src/WrapperRunner/SuiteLoader.php @@ -29,6 +29,7 @@ use function mt_srand; use function ob_get_clean; use function ob_start; +use function sprintf; use function str_starts_with; use function strlen; use function substr; @@ -85,10 +86,14 @@ public function __construct( $name = $test->name(); if ($test->providedData() !== []) { $dataName = $test->dataName(); - if (is_int($dataName)) { - $name .= '#' . $dataName; + if ($this->options->functional) { + $name = sprintf('/%s\s.*%s.*$/', $name, $dataName); } else { - $name .= '@' . $dataName; + if (is_int($dataName)) { + $name .= '#' . $dataName; + } else { + $name .= '@' . $dataName; + } } } diff --git a/test/Unit/WrapperRunner/WrapperRunnerTest.php b/test/Unit/WrapperRunner/WrapperRunnerTest.php index 0270bf04..9480a20c 100644 --- a/test/Unit/WrapperRunner/WrapperRunnerTest.php +++ b/test/Unit/WrapperRunner/WrapperRunnerTest.php @@ -633,7 +633,18 @@ public function testFunctionalParallelization(): void $this->bareOptions['--functional'] = true; $runnerResult = $this->runRunner(); - self::assertStringContainsString('.......', $runnerResult->output); + + $expectedOutput = <<<'EOF' +Processes: 2 +Runtime: PHP %s + +.......... 10 / 10 (100%) + +Time: %s, Memory: %s MB + +OK%a +EOF; + self::assertStringMatchesFormat($expectedOutput, $runnerResult->output); self::assertSame(RunnerInterface::SUCCESS_EXIT, $runnerResult->exitCode); } @@ -649,7 +660,18 @@ public function testFunctionalParallelizationWithJunitLogging(): void $this->bareOptions['--log-junit'] = $outputFile; $runnerResult = $this->runRunner(); - self::assertStringContainsString('.......', $runnerResult->output); + + $expectedOutput = <<<'EOF' +Processes: 1 +Runtime: PHP %s + +.......... 10 / 10 (100%) + +Time: %s, Memory: %s MB + +OK%a +EOF; + self::assertStringMatchesFormat($expectedOutput, $runnerResult->output); self::assertSame(RunnerInterface::SUCCESS_EXIT, $runnerResult->exitCode); } diff --git a/test/fixtures/function_parallelization_tests/FunctionalParallelizationTest.php b/test/fixtures/function_parallelization_tests/FunctionalParallelizationTest.php index db570845..cae2154f 100644 --- a/test/fixtures/function_parallelization_tests/FunctionalParallelizationTest.php +++ b/test/fixtures/function_parallelization_tests/FunctionalParallelizationTest.php @@ -41,4 +41,10 @@ public function testDataProvider2(string $a, string $b): void { self::assertEquals($a, $b); } + + #[DataProvider('dataProvider2')] + public function testDataProvider2SameBeginningOfName(string $a, string $b): void + { + self::assertEquals($a, $b); + } }