Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Niewrzal2017-06-18 17:10:06 -0400
committerKaloyan Raev2017-06-22 03:29:55 -0400
commite24f8ad712f00063cbd12711f2d52f4cd325d1fc (patch)
treed5005a3664faa64eea9e00e06bc5f434af05d70b
parent4674007bfc7de9e8e4c367cdeeb5d4e97201e569 (diff)
downloadorg.eclipse.pdt-e24f8ad712f00063cbd12711f2d52f4cd325d1fc.tar.gz
org.eclipse.pdt-e24f8ad712f00063cbd12711f2d52f4cd325d1fc.tar.xz
org.eclipse.pdt-e24f8ad712f00063cbd12711f2d52f4cd325d1fc.zip
Bug 518427 - Trace Failure isn't helpful to track unit test problem
Change-Id: Ibd0ac463cc75767862d4c06a2c8413d08c141a9a Signed-off-by: Michal Niewrzal <michal.n@zend.com>
-rw-r--r--plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/FailureTrace.java14
-rw-r--r--plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/TestLabelProvider.java5
2 files changed, 11 insertions, 8 deletions
diff --git a/plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/FailureTrace.java b/plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/FailureTrace.java
index aa68f8a76..7bb5d72d7 100644
--- a/plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/FailureTrace.java
+++ b/plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/FailureTrace.java
@@ -79,8 +79,9 @@ public class FailureTrace implements IMenuListener {
void handleDefaultSelected() {
final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
- if (selection.size() != 1)
+ if (selection.size() != 1) {
return;
+ }
final PHPUnitElement test = (PHPUnitElement) selection.getFirstElement();
OpenEditorAction action = null;
@@ -88,19 +89,18 @@ public class FailureTrace implements IMenuListener {
if (test instanceof PHPUnitTraceFrame) {
PHPUnitTraceFrame frame = (PHPUnitTraceFrame) test;
String methodName = frame.getFunction();
- String className = frame.getClassName();
- action = new OpenTestAction(OpenEditorAction.GOTO_METHOD, fTestRunner, className, null, 0, methodName);
-
+ action = new OpenEditorAtLineAction("", fTestRunner, frame.getFile(), frame.getLine(), methodName); //$NON-NLS-1$
} else if (test instanceof PHPUnitTestException) {
PHPUnitTestException te = (PHPUnitTestException) test;
PHPUnitTestCase parent = (PHPUnitTestCase) te.getParent();
String methodName = parent.getName();
-
- action = new OpenEditorAtLineAction("", fTestRunner, test.getParent().getFile(), te.getLine(), methodName); //$NON-NLS-1$
+ action = new OpenEditorAtLineAction("", fTestRunner, test.getParent().getFile(), parent.getLine(), //$NON-NLS-1$
+ methodName);
}
- if (action.isEnabled())
+ if (action.isEnabled()) {
action.run();
+ }
}
private void initMenu() {
diff --git a/plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/TestLabelProvider.java b/plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/TestLabelProvider.java
index 00f3f6a1e..87020210b 100644
--- a/plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/TestLabelProvider.java
+++ b/plugins/org.eclipse.php.phpunit/src/org/eclipse/php/phpunit/ui/view/TestLabelProvider.java
@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.DecorationOverlayIcon;
import org.eclipse.jface.viewers.IDecoration;
@@ -162,7 +163,9 @@ public class TestLabelProvider extends LabelProvider {
return prefix;
}
if (test instanceof PHPUnitTraceFrame) {
- return test.toString() + "()"; //$NON-NLS-1$
+ PHPUnitTraceFrame frame = (PHPUnitTraceFrame) test;
+ IPath path = new Path(frame.getFile());
+ return path.lastSegment() + " - " + test.toString() + "()"; //$NON-NLS-1$ //$NON-NLS-2$
}
return test.toString();
}

Back to the top