From 05ed59841a6e9f43900c1b1c09ca4baf9e6cf4ff Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Fri, 22 Nov 2024 17:56:27 +0900 Subject: [PATCH] =?UTF-8?q?default=20pattern=20=E3=81=AE=E3=82=B5=E3=83=8B?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=82=BA=E3=81=AE=E3=81=82=E3=81=A8=E3=80=81?= =?UTF-8?q?HTMLPurifier=20=E3=81=AB=E3=82=88=E3=81=A3=E3=81=A6=E5=AE=8C?= =?UTF-8?q?=E5=85=A8=E3=81=AB=E5=89=8A=E9=99=A4=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=8C=E3=81=82=E3=82=8B=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modifier/Modifier_ScriptEscapeTest.php | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/tests/class/modifier/Modifier_ScriptEscapeTest.php b/tests/class/modifier/Modifier_ScriptEscapeTest.php index fa35449aba..0eff2d46c8 100644 --- a/tests/class/modifier/Modifier_ScriptEscapeTest.php +++ b/tests/class/modifier/Modifier_ScriptEscapeTest.php @@ -11,33 +11,34 @@ class Modifier_ScriptEscapeTest extends PHPUnit_Framework_TestCase { public function scriptEscapeProvider() { + $default_pattern = '/#script escaped#/'; return [ - [''], - ['test'], - ['test'], - ['test'], - [''], - [''], - [''], - ['\"onclick=\"alert(1)\"'], - ['

test

'], - ['

test

'], - ['

test

'], - [''], - [''], - [''], - [''], - ['
'], - ['
javascript:test()
'], - [''], - [''], - [''], - ['
'], - [''], - [''], - [''], - [''], - ['
'], + ['', $default_pattern], + ['test', $default_pattern], + ['test', $default_pattern], + ['test', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['\"onclick=\"alert(1)\"', $default_pattern], + ['

test

', $default_pattern], + ['

test

', $default_pattern], + ['

test

', $default_pattern], + ['', '//'], // HTMLPurifier によって完全に削除される + ['', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['
', $default_pattern], + ['
javascript:test()
', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['', $default_pattern], + ['', '//'], // HTMLPurifier によって完全に削除される + ['
', $default_pattern], ]; } @@ -58,10 +59,10 @@ public function scriptNoEscapeProvider() /** * @dataProvider scriptEscapeProvider */ - public function testメールテンプレートエスケープされる($value) + public function testメールテンプレートエスケープされる($value, $pattern) { $ret = smarty_modifier_script_escape($value); - $pattern = '/#script escaped#/'; + var_dump($ret); $this->assertMatchesRegularExpression($pattern, $ret); }