Example #1
0
 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');
 }
Example #2
0
 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();
 }