Skip to content

Commit 32ffe20

Browse files
committed
test: fix PHPUnit Data Provider
1 parent 176e94f commit 32ffe20

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

tests/SecureTest.php

+14-12
Original file line numberDiff line numberDiff line change
@@ -46,52 +46,54 @@ protected function setUp(): void
4646
*/
4747
public static function provideExcel()
4848
{
49+
$PHPID = PHP_VERSION_ID;
50+
4951
yield from [
5052
'Excel 2024' => [
5153
'checkFiles' => 'excel2024.xlsx',
52-
'expectedFiles' => 'excel2024_result.xlsx',
54+
'expectedFiles' => 'excel2024_result' . $PHPID . '.xlsx',
5355
],
5456
'Excel 2024 - Strict' => [
5557
'checkFiles' => 'excel2024strict.xlsx',
56-
'expectedFiles' => 'excel2024strict_result.xlsx',
58+
'expectedFiles' => 'excel2024strict_result' . $PHPID . '.xlsx',
5759
],
5860
'Excel Macro' => [
5961
'checkFiles' => 'excelmacro.xlsm',
60-
'expectedFiles' => 'excelmacro_result.xlsm',
62+
'expectedFiles' => 'excelmacro_result' . $PHPID . '.xlsm',
6163
],
6264
'Excel Binary' => [
6365
'checkFiles' => 'excelbinary.xlsb',
64-
'expectedFiles' => 'excelbinary_result.xlsb',
66+
'expectedFiles' => 'excelbinary_result' . $PHPID . '.xlsb',
6567
],
6668
'Excel 97-2003' => [
6769
'checkFiles' => 'excel97.xls',
68-
'expectedFiles' => 'excel97_result.xls',
70+
'expectedFiles' => 'excel97_result' . $PHPID . '.xls',
6971
],
7072
'Excel 95' => [
7173
'checkFiles' => 'excel95.xls',
72-
'expectedFiles' => 'excel95_result.xls',
74+
'expectedFiles' => 'excel95_result' . $PHPID . '.xls',
7375
],
7476
'CSV UTF-8' => [
7577
'checkFiles' => 'csvutf8.csv',
76-
'expectedFiles' => 'csvutf8_result.csv',
78+
'expectedFiles' => 'csvutf8_result' . $PHPID . '.csv',
7779
],
7880
'CSV Unknown' => [
7981
'checkFiles' => 'csvunknown.csv',
80-
'expectedFiles' => 'csvunknown_result.csv',
82+
'expectedFiles' => 'csvunknown_result' . $PHPID . '.csv',
8183
],
8284
];
8385
}
8486

8587
#[DataProvider('provideExcel')]
8688
public static function testEncryptor(string $checkFiles = '', string $expectedFiles = ''): void
8789
{
88-
if (is_file(self::$folderSupportResult . $expectedFiles)) {
89-
unlink(self::$folderSupportResult . $expectedFiles);
90-
}
91-
9290
(new Secure())->setFile(self::$folderSupport . $checkFiles)->setPassword('111')->output(self::$folderSupportResult . $expectedFiles);
9391

9492
self::assertFileExists(self::$folderSupportResult . $expectedFiles);
93+
94+
if (is_file(self::$folderSupportResult . $expectedFiles)) {
95+
unlink(self::$folderSupportResult . $expectedFiles);
96+
}
9597
}
9698

9799
public static function testEncryptorWithBinaryData(): void
File renamed without changes.

0 commit comments

Comments
 (0)