Add unit test for nested arrays

This commit is contained in:
Lukas Reschke 2015-12-08 09:07:38 +01:00
parent 4b293dffe5
commit 6d3eb7673d
1 changed files with 12 additions and 6 deletions

View File

@ -95,16 +95,22 @@ class Test_Util extends \Test\TestCase {
}
function testSanitizeHTML() {
$badArray = array(
$badArray = [
'While it is unusual to pass an array',
'this function actually <blink>supports</blink> it.',
'And therefore there needs to be a <script>alert("Unit"+\'test\')</script> for it!'
);
$goodArray = array(
'And therefore there needs to be a <script>alert("Unit"+\'test\')</script> for it!',
[
'And It Even May <strong>Nest</strong>',
],
];
$goodArray = [
'While it is unusual to pass an array',
'this function actually &lt;blink&gt;supports&lt;/blink&gt; it.',
'And therefore there needs to be a &lt;script&gt;alert(&quot;Unit&quot;+&#039;test&#039;)&lt;/script&gt; for it!'
);
'And therefore there needs to be a &lt;script&gt;alert(&quot;Unit&quot;+&#039;test&#039;)&lt;/script&gt; for it!',
[
'And It Even May &lt;strong&gt;Nest&lt;/strong&gt;'
],
];
$result = OC_Util::sanitizeHTML($badArray);
$this->assertEquals($goodArray, $result);