如果我是正确的,SimpleTest 将允许您断言抛出 PHP 错误。但是,根据文档,我无法弄清楚如何使用它。我想断言我传递给构造函数的对象是MyOtherObject
class Object {
public function __construct(MyOtherObject $object) {
//do something with $object
}
}
//...and in my test I have...
public function testConstruct_ExpectsAnInstanceOfMyOtherObject() {
$notAnObject = 'foobar';
$object = new Object($notAnObject);
$this->expectError($object);
}
我哪里错了?