Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Use single test method check that exactly all property names are matched
  • Loading branch information
JakeQZ committed Jun 20, 2025
commit fcca94e4f02132c8f799b9742caad1ea68b0961b
30 changes: 4 additions & 26 deletions tests/Unit/RuleSet/RuleSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1182,32 +1182,10 @@ public function getRulesAssocWithPatternReturnsAllMatchingPropertyNames(

$result = $this->subject->getRulesAssoc($searchPattern);

foreach ($matchingPropertyNames as $expectedMatchingPropertyName) {
self::assertArrayHasKey($expectedMatchingPropertyName, $result);
}
}

/**
* @test
*
* @param list<string> $propertyNamesToSet
* @param list<string> $matchingPropertyNames
*
* @dataProvider providePropertyNamesAndSearchPatternAndMatchingPropertyNames
*/
public function getRulesAssocWithPatternFiltersNonMatchingRules(
array $propertyNamesToSet,
string $searchPattern,
array $matchingPropertyNames
): void {
$this->setRulesFromPropertyNames($propertyNamesToSet);

$result = $this->subject->getRulesAssoc($searchPattern);

foreach ($result as $resultRule) {
// 'expected' and 'actual' are transposed here due to necessity
self::assertContains($resultRule->getRule(), $matchingPropertyNames);
}
$resultPropertyNames = \array_keys($result);
\sort($matchingPropertyNames);
\sort($resultPropertyNames);
self::assertSame($matchingPropertyNames, $resultPropertyNames);
}

/**
Expand Down