|
From: Nicolas T. <nic...@gm...> - 2011-11-02 09:25:46
|
Hi,
I have a weird behavior and I would like to know if it is a bug in
SimpleTest or my misunderstanding.
A snippet is worth a thousand words:
<?php
class CarFactoryTest extends UnitTestCase {
function testPaint() {
$c1 = new MockCar();
$c2 = new MockCar();
$f = new MockCarFactory();
$f->setReturnValue('paint', true, array($c1));
$f->setReturnValue('paint', false, array($c2));
$this->assertTrue($f->paint($c1));
$this->assertFalse($f->paint($c2)); //fail :'(
}
}
class Car {
}
Mock::generate('Car');
class CarFactory {
function paint(Car $car) {
}
}
Mock::generate('CarFactory');
?>
The test is unfortunately red. I expect that two different objects
should generate different results.
Am I wrong?
Thanks,
Nicolas Terray
|