PHPUnit:assertInstanceOf()无法正常工作 [英] PHPUnit: assertInstanceOf() not working
本文介绍了PHPUnit:assertInstanceOf()无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要检查变量是否是User类型的对象.
用户是我的班级$user
我的对象
I need to check if a variable is an object of the User type.
User is my class $user
my object
$this->assertInstanceOf($user,User);
这不起作用,我使用了未定义的常量用户-假定为用户"
This is not working, I have a use of undefined constant User - assumed 'User'
预先感谢您的帮助
推荐答案
http://apigen .juzna.cz/doc/sebastianbergmann/phpunit/function-assertInstanceOf.html
我认为您使用此功能有误.试试:
I think you are using this function wrong. Try:
$this->assertInstanceOf('User', $user);
这篇关于PHPUnit:assertInstanceOf()无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文