|
From: Marcus B. <ma...@wo...> - 2008-12-14 17:19:01
|
Hi...
Nicolas Terray wrote:
> class Foo {
> public function bar(&$b) {
> $b = 666;
> }
> }
I find it hard to follow "foo" and "bar" examples, but the the exact
case you've presented is very difficult. You would have to subclass the
mock...
class Foo {
public function bar(&$b) {
$b = 666;
}
}
Mock::generate('Foo', 'BaseMockFoo');
class MockFoo extends BaseMockFoo {
function bar(&$b) {
$bar = parent::bar($b);
}
}
class InOutTest extends UnitTestCase {
function testInOut() {
$o = new InOut();
$foo1 = new Foo();
$this->assertEqual(666, $o->hello($foo1)); // This pass
$foo2 = new MockFoo($this);
$foo2->setReturnValue('bar', 111);
$this->assertEqual(111, $o->hello($foo2));
}
}
>
> Any help is welcome :)
I haven't tested this code (my kids are runing around undreneath my
feet), but it should work.
I've made a mental note that a future version should take care of this
more naturally.
>
> Best,
> Nicolas Terray
yours, Marcus
|