| Summary: | Constants with namespace can not be recognized rightly. | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Zhongwei Zhao <zhaozhongwei> |
| Component: | PDT | Assignee: | PHP Core <php.core-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | gadi |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
Zhongwei Zhao
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 fixed in head Closing regarding Zhao`s comment #2 Closed by Teodor Kirkov teodor.k@zend.com |