PHPUnit: assertInstanceOf() not working

后端 未结 3 1103
感动是毒
感动是毒 2021-02-02 05:13

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);
3条回答
  •  花落未央
    2021-02-02 05:43

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

    I think you are using this function wrong. Try:

    $this->assertInstanceOf('User', $user);
    

提交回复
热议问题