fix slash regression in toolbar signature #3045
[dokuwiki.git] / _test / tests / inc / toolbar.test.php
blob0116687dca802c62f0b37b3e793682cd647e0ea8
1 <?php
3 class toolbar_test extends DokuWikiTest {
5 function test_encode_toolbar_signature() {
6 global $conf, $INFO, $INPUT;
8 $conf['signature'] = '" --- \\\\n //[[@MAIL@|@NAME@]] (@USER@) @DATE@//"';
9 $_SERVER['REMOTE_USER'] = 'john';
10 $INFO['userinfo']['name'] = '/*!]]>*/</script><script>alert("\123\")</script>';
11 $INFO['userinfo']['mail'] = 'example@example.org';
13 $date = str_replace('/', '\/', dformat());
15 $expected = '"\" --- \\\n \/\/[[example@example.org|\/*!]]>*\/<\/script><script>'.
16 'alert(\"\\\\123\\\\\\")<\/script>]] (john) '.$date.'\/\/\""';
18 $this->assertEquals($expected, toolbar_signature());