@Before
  public void setUp() throws Exception {
    PHPCoreTests.waitForIndexer();
    PHPCoreTests.waitForAutoBuild();

    project1 = FileUtils.createProject("project1");

    IFolder folder = project1.getFolder("src");

    if (!folder.exists()) {
      folder.create(true, true, new NullProgressMonitor());
    }
    file = folder.getFile("test23.php");

    InputStream source =
        new ByteArrayInputStream(
            "<?php class Item { public $title;} class ItemEx extends Item{public $title;} $a=new ItemEx(); $a->title;?>"
                .getBytes());

    if (!file.exists()) {
      file.create(source, true, new NullProgressMonitor());
    } else {
      file.setContents(source, IFile.FORCE, new NullProgressMonitor());
    }

    PHPCoreTests.waitForIndexer();
    PHPCoreTests.waitForAutoBuild();
  }
  @Before
  public void setUp() throws Exception {
    System.setProperty("disableStartupRunner", "true");
    PHPCoreTests.waitForIndexer();
    PHPCoreTests.waitForAutoBuild();

    project1 = FileUtils.createProject("project1", PHPVersion.PHP5_3);

    IFolder folder = project1.getFolder("src");

    if (!folder.exists()) {
      folder.create(true, true, new NullProgressMonitor());
    }
    file = folder.getFile("test00294081.php");

    InputStream source =
        new ByteArrayInputStream(
            "<?php class MyClass{const constant = 'constant value';function showCons1tant() {echo self::constant;}}$class = new MyClass ();$class->showConstant ();echo $class::constant;?>"
                .getBytes());

    if (!file.exists()) {
      file.create(source, true, new NullProgressMonitor());
    } else {
      file.setContents(source, IFile.FORCE, new NullProgressMonitor());
    }

    PHPCoreTests.waitForIndexer();
    PHPCoreTests.waitForAutoBuild();
  }
  protected void checkTestResult(PdttFileExt testFile, IStructuredDocument structuredDocument) {
    List<FileInfo> files = testFile.getExpectedFiles();
    for (FileInfo expFile : files) {
      IFile file = project.findFile(expFile.getName());
      assertTrue(file.exists());

      String content = structuredDocument.get();

      // String newLine = System.getProperty("line.separator");
      // content = content.replaceAll(newLine, "").replaceAll(" ", "");
      // content = content.replaceAll("\n", "").replaceAll(" ", "");

      String diff = PHPCoreTests.compareContentsIgnoreWhitespace(expFile.getContents(), content);
      if (diff != null) {
        fail(diff);
      }
    }
  }
  /**
   * Creates test file with the specified content and calculates the source range for the selection.
   * Selection characters themself are stripped off.
   *
   * @param data File data
   * @return offset where's the offset character set.
   * @throws Exception
   */
  protected SourceRange createFile(String data) throws Exception {
    int left = data.indexOf(SELECTION_CHAR);
    if (left == -1) {
      throw new IllegalArgumentException("Selection characters are not set");
    }
    // replace the left character
    data = data.substring(0, left) + data.substring(left + 1);

    int right = data.indexOf(SELECTION_CHAR);
    if (right == -1) {
      throw new IllegalArgumentException("Selection is not closed");
    }
    data = data.substring(0, right) + data.substring(right + 1);

    testFile = project.getFile("pdttest/test.php");
    testFile.create(new ByteArrayInputStream(data.getBytes()), true, null);
    project.refreshLocal(IResource.DEPTH_ONE, null);

    project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
    PHPCoreTests.waitForIndexer();

    return new SourceRange(left, right - left);
  }