I am facing an unexpected behaviour trying to use the following:
$object instanceof $class
1/ PHP \'instanceof\' keyword and namespaces wor
You can test for instances using namespaces, but use the fully qualified class name.
For your test I would do this:
$class = "\\Tools\\Tests\\Entity\\testObject";
$object = new $class;
var_dump($object instanceof $class); //bool(true)
You can also test this way using single quotes and not worry about escaping your backslashes and save yourself a few keystrokes.
$class = '\Tools\Tests\Entity\testObject';
$object = new $class;
var_dump($object instanceof $class); //bool(true)