Arnaud Ad Arnaud Ad -4 years ago 150
PHP Question

PHPUnit: assertInstanceOf() not working

I need to check if a variable is an object of the User type.
User is my class

my object


This is not working, I have a use of undefined constant User - assumed 'User'

Thanks in advance for your help

Answer Source

I think you are using this function wrong. Try:

$this->assertInstanceOf('User', $user);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download