PHPUnit: assertInstanceOf() not working
http://apigen.juzna.cz/doc/sebastianbergmann/phpunit/function-assertInstanceOf.html
I think you are using this function wrong. Try:
$this->assertInstanceOf('User', $user);
It's always a good idea to use ::class
wherever you can. If you get used to this standard, you don't have to use FQCNs (fully qualified classnames), or escape backslashes. Also, IDEs provide better functionality if they know that User
here is not just a string, but rather a class.
$this->assertInstanceOf(User::class, $user);