1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Sat, 15 Feb 2025 15:51:59 +0100
Subject: Compatibility with recent PHPUnit (12)
---
tests/Extension/EscaperTest.php | 3 +++
tests/Extension/SandboxTest.php | 1 +
tests/LexerTest.php | 3 +++
3 files changed, 7 insertions(+)
diff --git a/tests/Extension/EscaperTest.php b/tests/Extension/EscaperTest.php
index 28df82d..7b59644 100644
--- a/tests/Extension/EscaperTest.php
+++ b/tests/Extension/EscaperTest.php
@@ -11,6 +11,7 @@ namespace Twig\Tests;
* file that was distributed with this source code.
*/
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Extension\EscaperExtension;
@@ -24,6 +25,7 @@ class EscaperTest extends TestCase
*
* @group legacy
*/
+ #[DataProvider('provideCustomEscaperCases')]
public function testCustomEscaper($expected, $string, $strategy)
{
$twig = new Environment(new ArrayLoader());
@@ -46,6 +48,7 @@ class EscaperTest extends TestCase
*
* @group legacy
*/
+ #[DataProvider('provideCustomEscaperCases')]
public function testCustomEscaperWithoutCallingSetEscaperRuntime($expected, $string, $strategy)
{
$twig = new Environment(new ArrayLoader());
diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index fd655f7..3dc75de 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -116,6 +116,7 @@ class SandboxTest extends TestCase
*
* @group legacy
*/
+ #[DataProvider('getSandboxedForExtendsAndUseTagsTests')]
public function testSandboxForExtendsAndUseTags(string $tag, string $template)
{
$this->expectDeprecation(\sprintf('Since twig/twig 3.12: The "%s" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitly in your sandbox policy if needed.', $tag));
diff --git a/tests/LexerTest.php b/tests/LexerTest.php
index a22a2fb..3f62c91 100644
--- a/tests/LexerTest.php
+++ b/tests/LexerTest.php
@@ -249,6 +249,7 @@ class LexerTest extends TestCase
*
* @dataProvider getStringWithEscapedDelimiterProducingDeprecation
*/
+ #[DataProvider('getStringWithEscapedDelimiterProducingDeprecation')]
public function testStringWithEscapedDelimiterProducingDeprecation(string $template, string $expected, string $expectedDeprecation)
{
$this->expectDeprecation($expectedDeprecation);
@@ -615,6 +616,7 @@ bar
/**
* @dataProvider getTemplateForUnclosedBracketInExpression
*/
+ #[DataProvider('getTemplateForUnclosedBracketInExpression')]
public function testUnclosedBracketInExpression(string $template, string $bracket)
{
$lexer = new Lexer(new Environment(new ArrayLoader()));
@@ -636,6 +638,7 @@ bar
/**
* @dataProvider getTemplateForUnexpectedBracketInExpression
*/
+ #[DataProvider('getTemplateForUnexpectedBracketInExpression')]
public function testUnexpectedBracketInExpression(string $template, string $bracket)
{
$lexer = new Lexer(new Environment(new ArrayLoader()));
|