15
15
use PhpOffice \PhpSpreadsheet \Worksheet \Worksheet ;
16
16
use PHPUnit \Framework \TestCase ;
17
17
18
+ // TODO - I think the spreadsheet below is too difficult for PhpSpreadsheet to calculate correctly.
19
+
18
20
class ArrayFunctions2Test extends TestCase
19
21
{
20
22
private const STYLESIZE14 = [
@@ -93,7 +95,8 @@ private function doPartijen(Worksheet $ws): int
93
95
94
96
$ lijn = 1 ;
95
97
for ($ i = 1 ; $ i <= $ this ->trn ['RONDEN ' ]; ++$ i ) {//aantal ronden oneven->heen en even->terug
96
- for ($ j = 0 ; $ j < count ($ saring ); ++$ j ) {//subronden
98
+ $ countSaring = count ($ saring );
99
+ for ($ j = 0 ; $ j < $ countSaring ; ++$ j ) {//subronden
97
100
++$ lijn ;
98
101
if (isset ($ KD [(($ i - 1 ) * $ this ->trn ['SUB_RONDEN ' ]) + $ j ], $ KD [(($ i - 1 ) * $ this ->trn ['SUB_RONDEN ' ]) + $ j ]['RONDE ' ])) {
99
102
$ ws ->setCellValue ([9 , $ lijn ], $ KD [(($ i - 1 ) * $ this ->trn ['SUB_RONDEN ' ]) + $ j ]['RONDE ' ]);
@@ -109,7 +112,8 @@ private function doPartijen(Worksheet $ws): int
109
112
$ ws ->getStyle ('A ' . $ lijn . ':L ' . $ lijn . '' )->applyFromArray (self ::STYLEBOLD14 );
110
113
111
114
$ s2 = explode (' ' , $ saring [$ j ]);
112
- for ($ k = 0 ; $ k < count ($ s2 ); ++$ k ) {//borden
115
+ $ counts2 = count ($ s2 );
116
+ for ($ k = 0 ; $ k < $ counts2 ; ++$ k ) {//borden
113
117
if (trim ($ s2 [$ k ]) == '' ) {
114
118
continue ;
115
119
}
@@ -302,6 +306,7 @@ public function testManyArraysOutput(): void
302
306
self ::assertSame ('Dirk ' , $ wsPartijen ->getCell ('I3 ' )->getCalculatedValue ());
303
307
self ::assertSame ('Rudy ' , $ wsPartijen ->getCell ('K4 ' )->getCalculatedValue ());
304
308
$ calcArray = $ wsSort2 ->getCell ('A2 ' )->getCalculatedValue ();
309
+ self ::assertCount (8 , $ calcArray );
305
310
$ spreadsheet ->disconnectWorksheets ();
306
311
}
307
312
}
0 commit comments