SkillAssessment::shouldReceive('addTwoNumbersAndAddName')
->with(3,5,'john')
->andReturn('thisstring is random and always passes anyway1341234123412343')->once();
A very basic mockup, expected return is:
8 john
so what I wanted to write is:
SkillAssessment::shouldReceive('addTwoNumbersAndAddName')
->with(3,5,'john')
->andReturn('8 john')->once();
it always passes, never matter if I write 8 join into the return or something else.
It fails though, as soon as I start changing say:addTwoNumbersAndAddName to something else, or ->with(4,10, 'john')
will fail
only the ->andReturn()
wont work
I am using laravel 5.4 and the command php artisan dusk
The andReturn
method sets what the test-double will return.
It will not check that a non-test-double would return that value on that method.
So it's perhaps just that you've confused that methods use.