getName()->thenReturn('test_tag'); $extension = Phake::mock('Spipu\Html2Pdf\Extension\ExtensionInterface'); Phake::when($extension)->getName()->thenReturn('test'); Phake::when($extension)->getTags()->thenReturn(array($tag)); $object = $this->getObject(); $object->addExtension($extension); $object->writeHTML('