Exemplo n.º 1
0
  @Before
  public void setUp() throws Exception {
    project1 = TestUtils.createProject("project1");
    IFolder folder = TestUtils.createFolder(project1, "src");
    file =
        TestUtils.createFile(
            folder, "RenameFolderTestCase21.php", "<?php class TestRenameClass{}?>");
    file =
        TestUtils.createFile(
            project1,
            "RenameFolderTestCase22.php",
            "<?php include './src/RenameFolderTestCase21.php'; ?>");

    TestUtils.waitForIndexer();
  }
Exemplo n.º 2
0
  /**
   * Creates test file with the specified content and calculates the offset at OFFSET_CHAR. Offset
   * character itself is stripped off.
   *
   * @param data File data
   * @return offset where's the offset character set.
   * @throws Exception
   */
  protected int createFile(String data) throws Exception {
    int offset = data.lastIndexOf(OFFSET_CHAR);
    if (offset == -1) {
      throw new IllegalArgumentException("Offset character is not set");
    }

    // replace the offset character
    data = data.substring(0, offset) + data.substring(offset + 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);

    TestUtils.waitForIndexer();

    return offset;
  }