Created
December 29, 2012 21:06
-
-
Save anonymous/4409376 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.