List<ForEachStatement> statements = getAllOfType(program,
ForEachStatement.class);
Assert.assertTrue("Unexpected list size.", statements.size() == 1);
statements.get(0).setKey(ast.newVariable("bar"));
Reference ref = ast.newReference(ast.newVariable("val"));
statements.get(0).setValue(ref);
rewrite();
checkResult("<?php foreach ($arr as $bar=>&$val) { $value = $value * 2; } ?>");
}