Community
Participate
Working Groups
A constant with the format "\a\b\TEST" can be recognized as a php constant in method PhpElementConciliator.concile().
Add the following method to class PhpElementConciliatorTest public void testConcileGlobalConstant() { PHPVersion oldversion = ProjectOptions.getPhpVersion(project1); boolean versionChanged = false; try { if (PHPVersion.PHP5_3 != oldversion) { PHPCoreTests.setProjectPhpVersion(project1, PHPVersion.PHP5_3); versionChanged = true; } } catch (CoreException e) { } try { IFile file = null; try { file = setFileContent("<?php namespace NS;define(\"CONSTANT\", \"Hello world.\"); echo \\NS\\CONSTANT;?>"); } catch (CoreException e) { fail(e.getMessage()); } assertNotNull(file); Program program = createProgram(file); assertNotNull(program); // select the function declaration. int start = 20; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT, PhpElementConciliator.concile(selectedNode)); start = 28; selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT, PhpElementConciliator.concile(selectedNode)); start = 51; selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT, PhpElementConciliator.concile(selectedNode)); start = 64; selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT, PhpElementConciliator.concile(selectedNode)); } finally { if (versionChanged) { ProjectOptions.setPhpVersion(oldversion, project1); PHPCoreTests.waitForAutoBuild(); PHPCoreTests.waitForIndexer(); } } } the code above will break the unit tests,and I think we need support php5.3 in class PhpElementConciliatorTest.
Sorry there is class PhpElementConciliatorV5_3Test for php5.3.
fixed in head
Closing regarding Zhao`s comment #2 Closed by Teodor Kirkov teodor.k@zend.com