PHPUnit can create Mock'i based on interfaces, which is called "out of the box". For this, in the base class of the test there is a special method TestCase::getMock .
For example, to create a Mock that implements your interface, you can use the following code:
class FooTest extends PHPUnit\Framework\TestCase { public function testFoo() { $mock = $this->getMock('\EditorAttributes'); $this->assertTrue($mock instanceof \EditorAttributes); } }
If you need Mock to implement more than one interface, you can pass an array with the names of the target interfaces to TestCase::getMock :
class FooTest extends PHPUnit\Framework\TestCase { public function testFoo() { $mock = $this->getMock(['\EditorAttributes', '\ReaderAttributes']); $this->assertTrue($mock instanceof \EditorAttributes); $this->assertTrue($mock instanceof \ReaderAttributes); } }