草庐IT

notAnObject

全部标签

php - SimpleTest:如何断言抛出 PHP 错误?

如果我是正确的,SimpleTest将允许您断言抛出PHP错误。但是,根据文档,我不知道如何使用它。我想断言我传递给构造函数的对象是MyOtherObject的一个实例classObject{publicfunction__construct(MyOtherObject$object){//dosomethingwith$object}}//...andinmytestIhave...publicfunctiontestConstruct_ExpectsAnInstanceOfMyOtherObject(){$notAnObject='foobar';$object=newObject