Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved regular expression for data-sets when functional flag is used. #914

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/WrapperRunner/SuiteLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use function mt_srand;
use function ob_get_clean;
use function ob_start;
use function preg_quote;
use function sprintf;
use function str_starts_with;
use function strlen;
Expand Down Expand Up @@ -87,7 +88,7 @@ public function __construct(
if ($test->providedData() !== []) {
$dataName = $test->dataName();
if ($this->options->functional) {
$name = sprintf('/%s\s.*%s.*$/', $name, $dataName);
$name = sprintf('/%s%s$/', preg_quote($name, '/'), preg_quote($test->dataSetAsString(), '/'));
} else {
if (is_int($dataName)) {
$name .= '#' . $dataName;
Expand Down
10 changes: 5 additions & 5 deletions test/Unit/WrapperRunner/WrapperRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ public function testGroupOptionWithDataProviderAndCodeCoverageEnabled(): void
* @see https://bugs.php.net/bug.php?id=77726
* @see https://github.com/php/php-src/pull/8114
*/
#[RequiresPhp('8.2')]
#[RequiresPhp('>=8.2')]
public function testFunctionalParallelization(): void
{
$this->bareOptions['path'] = $this->fixture('function_parallelization_tests');
Expand All @@ -643,7 +643,7 @@ public function testFunctionalParallelization(): void
Processes: 2
Runtime: PHP %s

.......... 10 / 10 (100%)
.................... 20 / 20 (100%)

Time: %s, Memory: %s MB

Expand All @@ -653,7 +653,7 @@ public function testFunctionalParallelization(): void
self::assertSame(RunnerInterface::SUCCESS_EXIT, $runnerResult->exitCode);
}

#[RequiresPhp('8.2')]
#[RequiresPhp('>=8.2')]
public function testSameBeginningOfName(): void
{
$this->bareOptions['path'] = $this->fixture('same_beginning_of_name');
Expand All @@ -675,7 +675,7 @@ public function testSameBeginningOfName(): void
self::assertSame(RunnerInterface::SUCCESS_EXIT, $runnerResult->exitCode);
}

#[RequiresPhp('8.2')]
#[RequiresPhp('>=8.2')]
public function testFunctionalParallelizationWithJunitLogging(): void
{
$outputFile = $this->tmpDir . DIRECTORY_SEPARATOR . 'test-output.xml';
Expand All @@ -692,7 +692,7 @@ public function testFunctionalParallelizationWithJunitLogging(): void
Processes: 1
Runtime: PHP %s

.......... 10 / 10 (100%)
.................... 20 / 20 (100%)

Time: %s, Memory: %s MB

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public static function dataProvider1(): array
['a', 'a'],
['b', 'b'],
['c', 'c'],
['d', 'd'],
['e', 'e'],
['f', 'f'],
['g', 'g'],
['h', 'h'],
['i', 'i'],
['k', 'k'],
['l', 'l'],
];
}

Expand All @@ -27,6 +35,7 @@ public static function dataProvider2(): array
'test1 with spaces' => ['a', 'a'],
"test2 with \0" => ['b', 'b'],
'test3' => ['c', 'c'],
'Test\\Class\\Name' => ['d', 'd'],
];
}

Expand Down
Loading