Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  fix not spreading the list of args of the scenario when filtering
  • Loading branch information
Baptouuuu committed Apr 4, 2020
2 parents 45808b9 + 4d76872 commit 4feed6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/PHPUnit/Scenario.php
Expand Up @@ -64,7 +64,9 @@ public function disableShrinking(): self
public function filter(callable $predicate): self
{
$self = clone $this;
$self->set = $this->set->filter($predicate);
$self->set = $this->set->filter(
static fn(array $args): bool => $predicate(...$args),
);

return $self;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPUnit/ScenarioTest.php
Expand Up @@ -59,8 +59,8 @@ public function testAllowToOnlyTakeACertainNumberOfScenarios()
public function testAllowAFilterCanBeAppliedOnTheScenario()
{
$scenario1 = new Scenario(Integers::any(), Integers::any());
$scenario2 = $scenario1->filter(static function($value): bool {
return ($value[0] + $value[1]) % 2 === 0;
$scenario2 = $scenario1->filter(static function($a, $b): bool {
return ($a + $b) % 2 === 0;
});

$this->assertNotSame($scenario1, $scenario2);
Expand Down

0 comments on commit 4feed6b

Please sign in to comment.