PhpParser\NodeTraverserTest::testRemove PHP Method

testRemove() public method

public testRemove ( )
    public function testRemove()
    {
        $str1Node = new String_('Foo');
        $str2Node = new String_('Bar');
        $visitor = $this->getMockBuilder('PhpParser\\NodeVisitor')->getMock();
        // remove the string1 node, leave the string2 node
        $visitor->expects($this->at(2))->method('leaveNode')->with($str1Node)->will($this->returnValue(false));
        $traverser = new NodeTraverser();
        $traverser->addVisitor($visitor);
        $this->assertEquals(array($str2Node), $traverser->traverse(array($str1Node, $str2Node)));
    }