|
From: Nicolas T. <nic...@gm...> - 2008-12-12 13:11:34
|
Hi,
I would like to test the behavior of a method which deals with in &
out parameters.
Here is a basic test case.
---8<---------
class InOut {
public function hello($foo) {
$a = 1;
$foo->bar($a);
return $a;
}
}
class Foo {
public function bar(&$b) {
$b = 666;
}
}
Mock::generate('Foo');
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->set......('bar', 111); // ???
$this->assertEqual(111, $o->hello($foo2));
}
}
---8<---------
How can I do that?
Any help is welcome :)
Best,
Nicolas Terray
|