|
From: Manuel V. <man...@gm...> - 2010-04-22 12:46:16
|
Hi,
It seems we already discuss about that here but I can't find the right message.
Anyhow, It seems that simpletest simple mock objects are not
inheriting from the parent by from SimpleMock class itself.
The direct consequence is the impossibility to use type hinting in
function declarations.
example:
require_once 'simpletest/autorun.php';
Mock::generate('PDO');
class MyOwnTest {
public function setPdo(PDO $dbh) {
}
}
class ForgeUpgradeTest extends UnitTestCase {
function testMyOwnTest() {
$pdo = new MockPDO($this);
$test = new MyOwnTest();
$test->setPdo($pdo);
}
}
Raises:
PHP Fatal error: Argument 1 passed to MyOwnTest::setPdo() must be an
instance of PDO, called in pdo.php on line 35 and defined in pdo.php
on line 25
Any chance to get it fixed ?
|