Skip to content

Commit 8539a48

Browse files
committed
More robust testing of expected arguments
1 parent 3cb3e40 commit 8539a48

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

Tests/Functional/ShortcodeFacadeTest.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,26 @@ protected function setUp(): void
3434
* @test
3535
* @dataProvider shortcodeFixtures
3636
*/
37-
public function processes_shortcodes(string $shortcode, ControllerReference $controllerReference, string $renderStrategy)
38-
{
37+
public function processes_shortcodes(
38+
string $shortcode,
39+
ControllerReference $expectedControllerReference,
40+
string $expectedRenderStrategy
41+
): void {
3942
$this->fragmentHandler->expects($this->once())
4043
->method('render')
41-
->with($controllerReference, $renderStrategy)
42-
->willReturn('OK');
44+
->willReturnCallback(
45+
function (
46+
ControllerReference $actualControllerReference,
47+
string $actualRenderStrategy
48+
) use (
49+
$expectedControllerReference,
50+
$expectedRenderStrategy
51+
) {
52+
return $actualControllerReference->controller === $expectedControllerReference->controller && $actualRenderStrategy === $expectedRenderStrategy
53+
? 'OK'
54+
: 'unexpected parameter values';
55+
}
56+
);
4357

4458
$this->assertEquals(
4559
'OK',

0 commit comments

Comments
 (0)