Skip to content

Commit

Permalink
ユニットテストの修正
Browse files Browse the repository at this point in the history
  • Loading branch information
dotani1111 authored and ji-eunsoo committed Nov 6, 2023
1 parent cb82ea9 commit 8739ec3
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -59,7 +66,7 @@ public function twigSnippetsProvider()
['{% set foo = "bar" %}', true],
['{% spaceless %}<div> <strong>test</strong> </div>{% endspaceless %}', true],
['{% flush %}', true],
['{% apply lower|escape("html") %}<strong>SOME TEXT</strong>{% endapply %}', false],
['{% apply lower|escape("html") %}<strong>SOME TEXT</strong>{% endapply %}', true],
['{% macro input(name, value, type = "text", size = 20) %}<input type="{{ type }}" name="{{ name }}" value="{{ value|e }}" size="{{ size }}"/>{% endmacro %}', false],
['{% sandbox %}{% include "user.html" %}{% endsandbox %}', false],
['{{ "-5"|abs }}', true],
Expand Down

0 comments on commit 8739ec3

Please sign in to comment.