for (String testsDirectory : TESTS.get(phpVersion)) {
for (final String fileName : getPDTTFiles(testsDirectory)) {
try {
final PdttFile pdttFile = new PdttFile(fileName);
phpVerSuite.addTest(new CompilerParserTests(phpVersion
.getAlias() + " - /" + fileName) {
protected void runTest() throws Throwable {
ByteArrayInputStream inputStream = new ByteArrayInputStream(
pdttFile.getFile().trim().getBytes());
ModuleDeclaration moduleDeclaration = (ModuleDeclaration) parser
.parse(new InputStreamReader(
inputStream),
null,
ProjectOptions
.useShortTags((IProject) null));
int offset = Integer.parseInt(pdttFile
.getConfig().get("offset"));
UseStatement[] useStatements = ASTUtils
.getUseStatements(moduleDeclaration,
offset);
StringBuilder builder = new StringBuilder();
for (UseStatement s : useStatements) {
builder.append(s);
}
String actual = builder.toString();
assertContents(pdttFile.getExpected(), actual);
}
});
} catch (final Exception e) {
// dummy test indicating PDTT file parsing failure
phpVerSuite.addTest(new TestCase(fileName) {