Created
July 5, 2013 13:26
-
-
Save gquemener/5934507 to your computer and use it in GitHub Desktop.
Mocking any object methods with mockery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This also clearly illustrates why both me and @MarcelloDuarte hate this established convention about
Interface
suffix for interfaces. Don't do that and life would be much easier!