Skip to content

Commit ff6b391

Browse files
committed
Test binary concat the same as binary plus
1 parent c7a7d43 commit ff6b391

File tree

2 files changed

+87
-40
lines changed

2 files changed

+87
-40
lines changed

tests/_files/source_with_heavy_indentation.php

+38-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function isTwo(): bool
9090
], true);
9191
}
9292

93-
public function variable(): bool
93+
public function variableBinaryPlus(): bool
9494
{
9595
$xa = $this->isOne();
9696
$xb = 1;
@@ -127,6 +127,43 @@ public function variable(): bool
127127
return $v2 === $v3;
128128
}
129129

130+
public function variableBinaryConcat(): bool
131+
{
132+
$xa = $this->isOne();
133+
$xb = 1;
134+
$xc = $xa;
135+
136+
$va
137+
=
138+
$vb
139+
=
140+
[
141+
$xa,
142+
$xb,
143+
1
144+
.
145+
$xb
146+
. 1,
147+
];
148+
149+
[
150+
$v2,
151+
$v3
152+
]
153+
=
154+
u(
155+
$xa,
156+
$xb,
157+
1
158+
.
159+
$xc
160+
.
161+
1
162+
);
163+
164+
return $v2 === $v3;
165+
}
166+
130167
public function noElse(): int
131168
{
132169
$res = 0;

tests/tests/Data/RawCodeCoverageDataTest.php

+49-39
Original file line numberDiff line numberDiff line change
@@ -358,63 +358,73 @@ public function testHeavyIndentationIsHandledCorrectly(): void
358358
101,
359359
// line 108 is unstable - variable has no coverage if it holds const expr - https://github.com/sebastianbergmann/php-code-coverage/issues/953
360360
113,
361-
// array destruct element, should be present 114,
361+
// array destruct element, should be present 114
362362
117,
363363
127,
364364
132,
365365
133,
366366
134,
367-
135,
368367
136,
369-
// line 137 is else statement, not in xdebug output (only if/elseif conditions are covered)
370368
138,
371-
141,
372-
146,
373-
148,
374-
149,
369+
// line 145 is unstable - same reason as line 108
370+
150,
371+
// array destruct element, should be present 151 - same reason as line 114
375372
154,
376-
157,
377-
162,
378-
// line 163 is try statement, not in xdebug output (only catch condition is covered)
379373
164,
380-
165,
381-
168,
374+
169,
375+
170,
376+
171,
377+
172,
382378
173,
383-
174,
379+
// line 174 is else statement, not in xdebug output (only if/elseif conditions are covered)
384380
175,
385-
// line 176 is finally statement, not in xdebug output (only catch condition is covered)
386-
177,
387-
180,
388-
188,
389-
193,
390-
195,
391-
197,
392-
198,
381+
178,
382+
183,
383+
185,
384+
186,
385+
191,
386+
194,
393387
199,
394-
200,
388+
// line 200 is try statement, not in xdebug output (only catch condition is covered)
389+
201,
395390
202,
396-
// line 203 is default case, not in xdebug output (only cases with condition are covered)
397-
204,
398-
207,
399-
216,
400-
218,
401-
220,
402-
222,
403-
224,
404-
226,
405-
228,
391+
205,
392+
210,
393+
211,
394+
212,
395+
// line 213 is finally statement, not in xdebug output (only catch condition is covered)
396+
214,
397+
217,
398+
225,
406399
230,
407400
232,
408401
234,
409-
256,
402+
235,
403+
236,
404+
237,
405+
239,
406+
// line 240 is default case, not in xdebug output (only cases with condition are covered)
407+
241,
408+
244,
409+
253,
410+
255,
411+
257,
412+
259,
410413
261,
414+
263,
411415
265,
412-
268,
413-
272,
414-
276,
415-
282,
416-
286,
417-
292,
416+
267,
417+
269,
418+
271,
419+
293,
420+
298,
421+
302,
422+
305,
423+
309,
424+
313,
425+
319,
426+
323,
427+
329,
418428
],
419429
array_keys(RawCodeCoverageData::fromUncoveredFile($file, new ParsingFileAnalyser(true, true))->lineCoverage()[$file])
420430
);

0 commit comments

Comments
 (0)