/** * Strip statements * * @expectOutputRegex #echo 'bar';# */ public function exampleStripNodes() { $reader = new Reader("<?php require 'Foo.php'; echo 'bar';"); $writer = new Writer(); $writer->apply(new Action\NodeStripper('Expr_Include')); // Outputs the echo statement echo $writer->write($reader->readAll()); }
public function testApplyTranslation() { $translation = $this->getMock('PhpParser\\NodeVisitor'); $traverser = $this->getMock('PhpParser\\NodeTraverser'); $traverser->expects($this->once())->method('addVisitor')->with($translation); $writer = new Writer($traverser); $writer->apply($translation); }