public function testGetReader() { $decorated = $this->getMockBuilder('hanneskod\\classtools\\Tests\\MockSplFileInfo')->setConstructorArgs([''])->getMock(); $decorated->expects($this->once())->method('getContents'); $fileInfo = new SplFileInfo($decorated); $reader = $fileInfo->getReader(); $this->assertInstanceOf('hanneskod\\classtools\\Transformer\\Reader', $reader); $this->assertSame($reader, $fileInfo->getReader(), 'The same reader instance must be cached'); }
public function testReaderException() { $decorated = $this->getMockBuilder('hanneskod\\classtools\\Tests\\MockSplFileInfo')->setConstructorArgs([''])->getMock(); $decorated->expects($this->once())->method('getContents')->will($this->returnValue('<?php func hej(){}')); $this->setExpectedException('\\hanneskod\\classtools\\Exception\\ReaderException'); $fileInfo = new SplFileInfo($decorated); $fileInfo->getReader(); }