class MyClass {} $obj = new MyClass(); $this->assertInstanceOf(MyClass::class, $obj);
interface MyInterface {} class MyClass implements MyInterface {} $obj = new MyClass(); $this->assertInstanceOf(MyInterface::class, $obj);In this example, we create a new object of the MyClass class which implements the MyInterface interface. We use the assertInstanceOf method to check if $obj is an instance of MyInterface. The PHPUnit_Framework_TestCase class is part of the PHPUnit package, which is a popular testing framework for PHP.