Skip to content

Instantly share code, notes, and snippets.

Created December 29, 2012 21:06
Show Gist options
  • Save anonymous/4409376 to your computer and use it in GitHub Desktop.
Save anonymous/4409376 to your computer and use it in GitHub Desktop.
class MyClass
{
public function foo($paramA, $paramB)
{
return $paramA . $paramB;
}
public function bar($paramA, $paramB)
{
// more crap here i don't care about
// .....
// and then the important part
return $this->foo($paramA, $paramB);
}
}
class MyClassToMockTest
{
public function getMyClassMock()
{
$myClass = new MyClass();
$mockedClass = \Mockery::mock($myClass);
$mockedClass->shouldRecevice('bar')
->with(\Mockery::any(), \Mockery::any())
->andReturnUsing( function($paramA, $paramB) {
// this will fail, so i am looking for a pointer on how to make it work
return $this->foo($paramA, $paramB);
});
}
}
@robertbasic
Copy link

That don't help much. I have no idea what's your real code. Also, if "bar" is "more crap here I don't care about" then why are you even testing it? Just test "foo" and that's it.

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