Package org.eclipse.php.core.tests.codeassist

Examples of org.eclipse.php.core.tests.codeassist.CodeAssistPdttFile$ExpectedProposal


      for (String testsDirectory : TESTS.get(phpVersion)) {

        for (final String fileName : getPDTTFiles(testsDirectory)) {
          try {
            final CodeAssistPdttFile pdttFile = new CodeAssistPdttFile(
                fileName);
            phpVerSuite.addTest(new SelectionEngineTests(phpVersion
                .getAlias() + " - /" + fileName) {

              protected void setUp() throws Exception {
                PHPCoreTests.setProjectPhpVersion(project,
                    phpVersion);
              }

              protected void tearDown() throws Exception {
                if (testFile != null) {
                  testFile.delete(true, null);
                  testFile = null;
                }
              }

              protected void runTest() throws Throwable {
                IModelElement[] elements = getSelection(pdttFile
                    .getFile());
                ExpectedProposal[] expectedProposals = pdttFile
                    .getExpectedProposals();

                boolean proposalsEqual = true;
                if (elements.length == expectedProposals.length) {
                  for (ExpectedProposal expectedProposal : pdttFile
                      .getExpectedProposals()) {
                    boolean found = false;
                    for (IModelElement modelElement : elements) {
                      if (modelElement.getElementType() == expectedProposal.type
                          && modelElement
                              .getElementName()
                              .equalsIgnoreCase(
                                  expectedProposal.name)) {
                        found = true;
                        break;
                      }
                    }
                    if (!found) {
                      proposalsEqual = false;
                      break;
                    }
                  }
                } else {
                  proposalsEqual = false;
                }

                if (!proposalsEqual) {
                  StringBuilder errorBuf = new StringBuilder();
                  errorBuf.append("\nEXPECTED ELEMENTS LIST:\n-----------------------------\n");
                  errorBuf.append(pdttFile.getExpected());
                  errorBuf.append("\nACTUAL ELEMENTS LIST:\n-----------------------------\n");
                  for (IModelElement modelElement : elements) {
                    switch (modelElement.getElementType()) {
                    case IModelElement.FIELD:
                      errorBuf.append("field");
View Full Code Here

TOP

Related Classes of org.eclipse.php.core.tests.codeassist.CodeAssistPdttFile$ExpectedProposal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.