Skip to content

Commit f40f9a6

Browse files
committed
Allow skipping duplicate tests in data providers
1 parent 74ce953 commit f40f9a6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/UnifiedSpecTests/UnifiedSpecTest.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PHPUnit\Framework\SkippedTest;
1111
use PHPUnit\Framework\Warning;
1212

13+
use function array_flip;
1314
use function basename;
1415
use function dirname;
1516
use function glob;
@@ -192,6 +193,8 @@ class UnifiedSpecTest extends FunctionalTestCase
192193
'index-management/search index operations ignore read and write concern: listSearchIndexes ignores read and write concern' => 'libmongoc appends readConcern to aggregate command',
193194
];
194195

196+
private static array $duplicateTests = ['crud/client bulkWrite partial results: partialResult is set when first operation fails during an unordered bulk write (summary)'];
197+
195198
/**
196199
* Any tests that rely on session pinning (including targetedFailPoint) must
197200
* be skipped since libmongoc does not pin on load-balanced toplogies. */
@@ -494,11 +497,19 @@ private static function provideTests(string $directory, ?string $group = null):
494497
{
495498
$pattern = self::$testDir . '/' . $directory . '/*.json';
496499

500+
$duplicateTests = array_flip(self::$duplicateTests);
501+
497502
foreach (glob($pattern) as $filename) {
498503
$testGroup = $group ?? dirname(basename($filename));
499504

500505
foreach (UnifiedTestCase::fromFile($filename) as $name => $test) {
501-
yield $testGroup . '/' . $name => [$test];
506+
$testKey = $testGroup . '/' . $name;
507+
508+
if (isset($duplicateTests[$testKey])) {
509+
continue;
510+
}
511+
512+
yield $testKey => [$test];
502513
}
503514
}
504515
}

0 commit comments

Comments
 (0)