Skip to content

Instantly share code, notes, and snippets.

@jwalton512
Created August 24, 2014 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwalton512/1c12e8a50d17245cdcdd to your computer and use it in GitHub Desktop.
Save jwalton512/1c12e8a50d17245cdcdd to your computer and use it in GitHub Desktop.
phpspec callback matcher
function it_handles_register_command(MemberRepository $members)
{
$command = new MemberRegisterCommand('email', 'password', 'password');
$members->save(Argument::that(function($member) {
return ($member->email == 'email' && $member->password == 'password');
}))->shouldBeCalled();
$this->handle($command)->shouldBeAnInstanceOf(MemberRegisterCommandResponse::class);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment