@@ -117,8 +117,17 @@ private function convertOldAssertionToNew($assertion)
117
117
$ newString = "< $ assertType " ;
118
118
$ subElements = ["actual " => [], "expected " => []];
119
119
foreach ($ sortedParts as $ type => $ value ) {
120
- $ value = rtrim (ltrim ($ value , '" ' ), '" ' );
121
- $ value = rtrim (ltrim ($ value , "' " ), "' " );
120
+ if (strpos ($ value , '" ' ) === 0 ) {
121
+ $ value = rtrim (ltrim ($ value , '" ' ), '" ' );
122
+ } elseif (strpos ($ value , "' " ) === 0 ) {
123
+ $ value = rtrim (ltrim ($ value , "' " ), "' " );
124
+ }
125
+ // If value is empty string, trim again
126
+ if (str_replace (" " , "" , $ value ) == "'' " ) {
127
+ $ value = "" ;
128
+ } elseif (str_replace (" " , "" , $ value ) == '"" ' ) {
129
+ $ value = "" ;
130
+ }
122
131
$ trimmedParts [$ type ] = $ value ;
123
132
if (in_array ($ type , ["stepKey " , "delta " , "message " , "before " , "after " , "remove " ])) {
124
133
if ($ type == "stepKey " ) {
@@ -131,7 +140,7 @@ private function convertOldAssertionToNew($assertion)
131
140
$ subElements ["actual " ]["value " ] = $ value ;
132
141
} elseif ($ type == "actualType " ) {
133
142
$ subElements ["actual " ]["type " ] = $ value ;
134
- } elseif ($ type == "expected " || $ type = "expectedValue " ) {
143
+ } elseif ($ type == "expected " or $ type = = "expectedValue " ) {
135
144
$ subElements ["expected " ]["value " ] = $ value ;
136
145
} elseif ($ type == "expectedType " ) {
137
146
$ subElements ["expected " ]["type " ] = $ value ;
@@ -159,10 +168,6 @@ private function convertOldAssertionToNew($assertion)
159
168
}
160
169
$ value = $ subElement ['value ' ];
161
170
$ typeValue = $ subElement ['type ' ];
162
- if (empty ($ value )) {
163
- $ this ->errors [] = "POTENTIAL ANOMALOUS OUPUT DETECTED, PLEASE MANUALLY CHECK OUTPUT " .
164
- "( $ assertType \"$ stepKey \" in $ this ->currentFile ) " ;
165
- }
166
171
$ newString .= "\t\t\t< {$ type }Result type= \"$ typeValue \"> $ value</ {$ type }Result> \n" ;
167
172
}
168
173
}
0 commit comments