Skip to content

Commit 7b1e5d2

Browse files
authored
Delete Temporary Files In XssVulnerabilityTest (#1800)
* Delete Temporary Files In XssVulnerabilityTest They need not exist after the test. Some of them are placed in current directory, which means Git thinks they are needed.
1 parent 4134ff2 commit 7b1e5d2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/PhpSpreadsheetTests/Writer/Html/XssVulnerabilityTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function testMarkupInComment($safeTextString, $adjustedTextString): void
4343
$writer->save($filename);
4444

4545
$verify = file_get_contents($filename);
46+
unlink($filename);
4647
// Ensure that executable js has been stripped from the comments
4748
self::assertStringContainsString($adjustedTextString, $verify);
4849
}
@@ -58,8 +59,6 @@ public function providerXssRichText()
5859
];
5960
}
6061

61-
private static $counter = 0;
62-
6362
/**
6463
* @dataProvider providerXssRichText
6564
*
@@ -84,8 +83,7 @@ public function testXssInComment($xssTextString): void
8483
$writer->save($filename);
8584

8685
$verify = file_get_contents($filename);
87-
$counter = self::$counter++;
88-
file_put_contents("verify{$counter}.html", $verify);
86+
unlink($filename);
8987
// Ensure that executable js has been stripped from the comments
9088
self::assertStringNotContainsString($xssTextString, $verify);
9189
}

0 commit comments

Comments
 (0)