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('
Hello
'); Phake::verify($tag, Phake::times(4))->open; Phake::verify($tag, Phake::times(2))->close; } }