|
From: Peter S. <cab...@gm...> - 2009-05-30 17:28:16
|
Hi,
I had a class that had a __destruct method in it ClassA for discussions
ClassB used ClassA but for testing of ClassB I wanted to mock out ClassA so
I did Mock::generate('ClassA') and then in the test case I told ClassB to
use MockClassA by ClassBObj->setClassAInstance(new MockClassA()) . I then
found that the __destruct method from the non mocked ClassA was getting
called in the test. This failed because it relied on something that had been
mocked out.
As a work around I have moved the clean up code from __desctruct to both of
the main work functions. It's not really a big deal if for some reason this
cannot be changed but it wasn't intuitive and is a gotcha I thought worth
asking about.
I am using simpletest 1.0.1
Cheers,
Pete
|