Conditions | 6 |
Paths | 10 |
Total Lines | 23 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | public function testAffectedByPhp9(): void |
||
14 | { |
||
15 | if (PHP_VERSION_ID >= 90000) { |
||
16 | $this->expectException(ReaderException::class); |
||
17 | $this->expectExceptionMessage('Php7.4 or Php8'); |
||
18 | } |
||
19 | $dir = 'tests/data/Reader/CSV'; |
||
20 | $files = glob("$dir/*"); |
||
21 | self::assertNotFalse($files); |
||
22 | $affected = []; |
||
23 | foreach ($files as $file) { |
||
24 | $base = basename($file); |
||
25 | $encoding = 'UTF-8'; |
||
26 | if (str_contains($base, 'utf') && !str_contains($base, 'bom')) { |
||
27 | $encoding = 'guess'; |
||
28 | } |
||
29 | $result = Csv::affectedByPhp9($file, $encoding); |
||
30 | if ($result) { |
||
31 | $affected[] = $base; |
||
32 | } |
||
33 | } |
||
34 | $expected = ['backslash.csv', 'escape.csv', 'linend.mac.csv']; |
||
35 | self::assertSame($expected, $affected); |
||
36 | } |
||
38 |