Skip to content

Instantly share code, notes, and snippets.

@pavlakis
Created November 9, 2017 11:01
Show Gist options
  • Save pavlakis/7481ffd11241d2c79bab578903fac39c to your computer and use it in GitHub Desktop.
Save pavlakis/7481ffd11241d2c79bab578903fac39c to your computer and use it in GitHub Desktop.
Mockery fails on with() with omitted optional values
class MyClass
{
public function doStuff($param, array $optional = [])
{
// some logic
return true;
}
}
// this fails
$myClassMock->shouldReceive('doStuff')
->with('some param')
->once()
->andReturn(true);
// this passes
$myClassMock->shouldReceive('doStuff')
->with('some param', [])
->once()
->andReturn(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment