Skip to content

Commit

Permalink
add test for named arguments for scope optionalArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
LordSimal committed Jan 10, 2023
1 parent 2dea1b1 commit 10051f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/TestCase/AuthorizationServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,21 @@ public function testApplyScopeAdditionalArguments()
$query->method('getRepository')
->willReturn($articles);

$query->expects($this->once())
$query->expects($this->exactly(2))
->method('where')
->with([
'identity_id' => 9,
'firstArg' => 'first argument',
'secondArg' => false,
])
->willReturn($query);

$result = $service->applyScope($user, 'additionalArguments', $query, 'first argument', false);
$this->assertInstanceOf(QueryInterface::class, $result);
$this->assertSame($query, $result);

// Test with named args as well
$result = $service->applyScope($user, 'additionalArguments', $query, firstArg: 'first argument', secondArg: false);
$this->assertInstanceOf(QueryInterface::class, $result);
$this->assertSame($query, $result);
}
Expand Down

0 comments on commit 10051f4

Please sign in to comment.