Skip to content
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: 1 addition & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ The following matrix shows the versions that are currently maintained.
| Version | Supported |
|---------|--------------------|
| 2.x | :white_check_mark: |
| 1.5.x | :white_check_mark: |
| < 1.5.0 | :x: |
| < 2.x | :x: |

## Reporting a Vulnerability

Expand Down
54 changes: 25 additions & 29 deletions tests/Behavior/AttrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,15 @@ public function withValuesClonesInstanceWhenModified(): void
self::assertNotSame($attr, $attr->withValues($valueA, $valueD));
}

public static function matchesNameDataProvider(): array
public static function matchesNameDataProvider(): iterable
{
return [
[ Attr::BLUNT, 'name', 'name', true ],
[ Attr::BLUNT, 'name', 'other', false ],
[ Attr::BLUNT, 'name', 'name-other', false ],
[ Attr::NAME_PREFIX, 'name-', 'name-', true ],
[ Attr::NAME_PREFIX, 'name-', 'name-other', true ],
[ Attr::NAME_PREFIX, 'name-', 'name', false ],
[ Attr::NAME_PREFIX, 'name-', 'other', false ],
];
yield [ Attr::BLUNT, 'name', 'name', true ];
yield [ Attr::BLUNT, 'name', 'other', false ];
yield [ Attr::BLUNT, 'name', 'name-other', false ];
yield [ Attr::NAME_PREFIX, 'name-', 'name-', true ];
yield [ Attr::NAME_PREFIX, 'name-', 'name-other', true ];
yield [ Attr::NAME_PREFIX, 'name-', 'name', false ];
yield [ Attr::NAME_PREFIX, 'name-', 'other', false ];
}

/**
Expand All @@ -105,30 +103,28 @@ public function matchesName(int $flags, string $name, string $matchName, bool $e
self::assertSame($expectation, $attr->matchesName($matchName));
}

public static function matchesValueDataProvider(): array
public static function matchesValueDataProvider(): iterable
{
$equalsA = new DatasetAttrValue('a');
$equalsB = new DatasetAttrValue('b');
$equalsAorB = new DatasetAttrValue('a', 'b');

return [
[ Attr::MATCH_ALL_VALUES, [$equalsA], 'a', true ],
[ Attr::MATCH_ALL_VALUES, [$equalsA], 'b', false ],
[ Attr::MATCH_ALL_VALUES, [$equalsAorB], 'a', true ],
[ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsAorB], 'a', true ],
[ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsB], 'a', false ], // both `$equalsA` and `$equalsB` must match
[ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsB], 'b', false ], // both `$equalsA` and `$equalsB` must match
[ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsB], 'c', false ],
[ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsB, $equalsAorB], 'c', false ],
[ Attr::BLUNT, [$equalsA], 'a', true ],
[ Attr::BLUNT, [$equalsA], 'b', false ],
[ Attr::BLUNT, [$equalsAorB], 'a', true ],
[ Attr::BLUNT, [$equalsA, $equalsAorB], 'a', true ],
[ Attr::BLUNT, [$equalsA, $equalsB], 'a', true ],
[ Attr::BLUNT, [$equalsA, $equalsB], 'b', true ],
[ Attr::BLUNT, [$equalsA, $equalsB], 'c', false ],
[ Attr::BLUNT, [$equalsA, $equalsB, $equalsAorB], 'c', false ],
];
yield [ Attr::MATCH_ALL_VALUES, [$equalsA], 'a', true ];
yield [ Attr::MATCH_ALL_VALUES, [$equalsA], 'b', false ];
yield [ Attr::MATCH_ALL_VALUES, [$equalsAorB], 'a', true ];
yield [ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsAorB], 'a', true ];
yield [ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsB], 'a', false ]; // both `$equalsA` and `$equalsB` must match
yield [ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsB], 'b', false ]; // both `$equalsA` and `$equalsB` must match
yield [ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsB], 'c', false ];
yield [ Attr::MATCH_ALL_VALUES, [$equalsA, $equalsB, $equalsAorB], 'c', false ];
yield [ Attr::BLUNT, [$equalsA], 'a', true ];
yield [ Attr::BLUNT, [$equalsA], 'b', false ];
yield [ Attr::BLUNT, [$equalsAorB], 'a', true ];
yield [ Attr::BLUNT, [$equalsA, $equalsAorB], 'a', true ];
yield [ Attr::BLUNT, [$equalsA, $equalsB], 'a', true ];
yield [ Attr::BLUNT, [$equalsA, $equalsB], 'b', true ];
yield [ Attr::BLUNT, [$equalsA, $equalsB], 'c', false ];
yield [ Attr::BLUNT, [$equalsA, $equalsB, $equalsAorB], 'c', false ];
}

/**
Expand Down
14 changes: 6 additions & 8 deletions tests/Behavior/TagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@

class TagTest extends TestCase
{
public function ambiguityIsDetectedDataProvider(): array
public static function ambiguityIsDetectedDataProvider(): iterable
{
return [
[ ['same'], ['same'], 1625394715 ],
[ ['same', 'same'], [], 1625590355 ],
[ ['same', 'same'], ['same'], 1625590355 ],
[ [], ['same', 'same'], 1625590355 ],
[ ['same'], ['same', 'same'], 1625590355 ],
];
yield [ ['same'], ['same'], 1625394715 ];
yield [ ['same', 'same'], [], 1625590355 ];
yield [ ['same', 'same'], ['same'], 1625590355 ];
yield [ [], ['same', 'same'], 1625590355 ];
yield [ ['same'], ['same', 'same'], 1625590355 ];
}

/**
Expand Down
12 changes: 5 additions & 7 deletions tests/BehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@

class BehaviorTest extends TestCase
{
public function ambiguityIsDetectedDataProvider(): array
public static function ambiguityIsDetectedDataProvider(): iterable
{
return [
[ ['same', 'same'], [], 1625591503 ],
[ ['same', 'same'], ['same'], 1625591503 ],
[ [], ['same', 'same'], 1625591503 ],
[ ['same'], ['same', 'same'], 1625591503 ],
];
yield [ ['same', 'same'], [], 1625591503 ];
yield [ ['same', 'same'], ['same'], 1625591503 ];
yield [ [], ['same', 'same'], 1625591503 ];
yield [ ['same'], ['same', 'same'], 1625591503 ];
}

/**
Expand Down
Loading
Loading