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.
This commit is contained in:
oleibman 2021-01-28 01:52:54 -08:00 committed by GitHub
parent 4134ff246a
commit 7b1e5d2f39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -43,6 +43,7 @@ class XssVulnerabilityTest extends Functional\AbstractFunctional
$writer->save($filename);
$verify = file_get_contents($filename);
unlink($filename);
// Ensure that executable js has been stripped from the comments
self::assertStringContainsString($adjustedTextString, $verify);
}
@ -58,8 +59,6 @@ class XssVulnerabilityTest extends Functional\AbstractFunctional
];
}
private static $counter = 0;
/**
* @dataProvider providerXssRichText
*
@ -84,8 +83,7 @@ class XssVulnerabilityTest extends Functional\AbstractFunctional
$writer->save($filename);
$verify = file_get_contents($filename);
$counter = self::$counter++;
file_put_contents("verify{$counter}.html", $verify);
unlink($filename);
// Ensure that executable js has been stripped from the comments
self::assertStringNotContainsString($xssTextString, $verify);
}