From 8739ec39a46d9d9f3afcf7dc510bd75d9c9de0ef Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Fri, 20 Oct 2023 17:41:51 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A6=E3=83=8B=E3=83=83=E3=83=88=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IgnoreTwigSandboxErrorExtensionTest.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/Eccube/Tests/Twig/Extension/IgnoreTwigSandboxErrorExtensionTest.php b/tests/Eccube/Tests/Twig/Extension/IgnoreTwigSandboxErrorExtensionTest.php index 0a8fe1e075b..12acecb275f 100644 --- a/tests/Eccube/Tests/Twig/Extension/IgnoreTwigSandboxErrorExtensionTest.php +++ b/tests/Eccube/Tests/Twig/Extension/IgnoreTwigSandboxErrorExtensionTest.php @@ -48,8 +48,15 @@ public function testMetatags($snippet, $whitelisted) $crawler = $this->client->request('GET', $this->generateUrl($Page->getUrl())); $text = $crawler->text(); - // $snippetがsandboxで制限された場合はメタタグエリアは空で出力されるため、__RENDERED__の出力有無で結果を確認する - self::assertContains($whitelisted ? '__RENDERED__' : '', $text); + // ホワイトリストに入っている場合__RENDERED__が表示される + if ($whitelisted) { + self::assertContains('__RENDERED__', $text); + } else { + self::assertNotContains('__RENDERED__', $text); + } + // 入力可能ではない値の場合は、システムエラーが発生する + self::assertNotContains('システムエラーが発生しました', $text); + } public function twigSnippetsProvider() @@ -59,7 +66,7 @@ public function twigSnippetsProvider() ['{% set foo = "bar" %}', true], ['{% spaceless %}
test
{% endspaceless %}', true], ['{% flush %}', true], - ['{% apply lower|escape("html") %}SOME TEXT{% endapply %}', false], + ['{% apply lower|escape("html") %}SOME TEXT{% endapply %}', true], ['{% macro input(name, value, type = "text", size = 20) %}{% endmacro %}', false], ['{% sandbox %}{% include "user.html" %}{% endsandbox %}', false], ['{{ "-5"|abs }}', true],