Arnaud Ad Arnaud Ad - 1 year ago 99
PHP Question

PHPUnit: assertInstanceOf() not working

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'

Thanks in advance for your help

Answer Source

http://apigen.juzna.cz/doc/sebastianbergmann/phpunit/function-assertInstanceOf.html

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