Skip to content

Instantly share code, notes, and snippets.

@gquemener
Created July 5, 2013 13:26
Show Gist options
  • Save gquemener/5934507 to your computer and use it in GitHub Desktop.
Save gquemener/5934507 to your computer and use it in GitHub Desktop.
Mocking any object methods with mockery
<?php
/**
* @param stdClass $object
*/
function it_should_do_stuff($object)
{
$object->getBar()->willReturn('foo');
$stuffedObject = $this->doStuff($object);
$stuffedObject->getBar()->shouldReturn('FOO');
}
// Like that, no need to create some spec objects
@gquemener
Copy link
Author

Damn, I didn't see your answer 'til today @everzet, thanks for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment