/** * Stub for writes * * @param \Trismegiste\Mondrian\Parser\PhpFile $file */ public function write(PhpFile $file) { $fch = $file->getRealPath(); $stmts = iterator_to_array($file->getIterator()); $prettyPrinter = new \PHPParser_PrettyPrinter_Default(); $this->storage[basename($fch)] = $this->getMockFile($fch, "<?php\n\n" . $prettyPrinter->prettyPrint($stmts)); $this->invocationMocker->invoke(new \PHPUnit_Framework_MockObject_Invocation_Object('VirtualPhpDumper', 'write', array(basename($fch)), $this)); }
public function stubbedTestedWrite(PhpFile $file) { $this->assertEquals('/addicted/to/Chaos.php', $file->getRealPath()); $generated = $file->getIterator(); $this->assertCount(2, $generated); $this->assertInstanceOf('\\PHPParser_Node_Stmt_Namespace', $generated[0]); $this->assertInstanceOf('\\PHPParser_Node_Stmt_Interface', $generated[1]); $interf = $generated[1]->stmts; $this->assertInstanceOf('\\PHPParser_Node_Stmt_ClassMethod', $interf[0]); $this->assertEquals('forsaken', $interf[0]->name); }