File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed
src/main/java/de/espend/idea/php/phpunit/utils Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 1- ideaVersion = IU-2019.2
2- phpPluginVersion = 192.5728.108
1+ ideaVersion = IU-2020.1
2+ phpPluginVersion = 201.6668.153
Original file line number Diff line number Diff line change @@ -98,17 +98,19 @@ private static PhpPsiElement resolveField(@NotNull FieldReference fieldReference
9898 Method methodScope = PhpPsiUtil .getParentByCondition (fieldReference , Method .INSTANCEOF );
9999 if (methodScope != null ) {
100100 PhpClass phpClass = methodScope .getContainingClass ();
101- if (phpClass != null /* && PhpUnitPluginUtil.isTestClassWithoutIndexAccess(phpClass) */ ) {
102- Method method = phpClass .findOwnMethodByName ("setUp" );
103-
104- // "setUp" is our "constructor" for test classes
105- if (method != null ) {
106- for (AssignmentExpression assignmentExpression : PsiTreeUtil .collectElementsOfType (method , AssignmentExpression .class )) {
107- PhpPsiElement variable = assignmentExpression .getVariable ();
108-
109- // remember or field name and attach is for a later resolve
110- if (variable instanceof FieldReference && name .equals (variable .getName ())) {
111- return assignmentExpression .getValue ();
101+ if (phpClass != null ) {
102+ for (String setupMethod : new String []{"setUp" , "setUpBeforeTest" }) {
103+ Method method = phpClass .findOwnMethodByName (setupMethod );
104+
105+ // "setUp" is our "constructor" for test classes
106+ if (method != null ) {
107+ for (AssignmentExpression assignmentExpression : PsiTreeUtil .collectElementsOfType (method , AssignmentExpression .class )) {
108+ PhpPsiElement variable = assignmentExpression .getVariable ();
109+
110+ // remember or field name and attach is for a later resolve
111+ if (variable instanceof FieldReference && name .equals (variable .getName ())) {
112+ return assignmentExpression .getValue ();
113+ }
112114 }
113115 }
114116 }
You can’t perform that action at this time.
0 commit comments