|
From: Dagfinn R. <da...@re...> - 2008-09-03 07:56:13
|
todd runstein wrote:
> I'm looking for a way to make my mock object throw an exception. I want to
> test that my class under test catches and handles any thrown exceptions
> correctly. I want to add a call to my mock object similar to:
>
> $this->mymock->setReturnValue('doomedmethod', new Exception('thanks'));
>
> Or even better:
> $this->mymock->expectAndThrow('doomedmethod', new Exception('thanks'));
>
> Any advice on whether this exists in simpletest? If not, is there any other
> way to test my classes exception handling logic?
>
> Thanks,
>
> Todd
>
>
You can decorate the mock object as I explain in my response to this thread:
*http://tinyurl.com/5n9w4l*
|