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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
From: Ruud Kamphuis <ruudk@users.noreply.github.com>
Date: Mon, 25 Nov 2024 11:50:28 +0100
Subject: [Twig 4] Add PHPUnit as dev dependency
Origin: backport, https://github.com/twigphp/twig/commit/c352a8d283bdf39e1b6bcc31e1a9be0bcfc82cb1
---
composer.json | 4 ++--
tests/DeprecatedCallableInfoTest.php | 5 ++---
tests/LexerTest.php | 12 +++---------
tests/Util/CallableArgumentsExtractorTest.php | 5 ++---
4 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/composer.json b/composer.json
index 3662366..1962434 100644
--- a/composer.json
+++ b/composer.json
@@ -5,7 +5,6 @@
"keywords": ["templating"],
"homepage": "https://twig.symfony.com",
"license": "BSD-3-Clause",
- "minimum-stability": "dev",
"authors": [
{
"name": "Fabien Potencier",
@@ -32,7 +31,8 @@
"require-dev": {
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0",
"psr/container": "^1.0|^2.0",
- "phpstan/phpstan": "^2.0"
+ "phpstan/phpstan": "^2.0",
+ "phpunit/phpunit": "^11.4"
},
"autoload": {
"files": [
diff --git a/tests/DeprecatedCallableInfoTest.php b/tests/DeprecatedCallableInfoTest.php
index 454d826..f30cc2e 100644
--- a/tests/DeprecatedCallableInfoTest.php
+++ b/tests/DeprecatedCallableInfoTest.php
@@ -11,14 +11,13 @@ namespace Twig\Tests;
* file that was distributed with this source code.
*/
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Twig\DeprecatedCallableInfo;
class DeprecatedCallableInfoTest extends TestCase
{
- /**
- * @dataProvider provideTestsForTriggerDeprecation
- */
+ #[DataProvider('provideTestsForTriggerDeprecation')]
public function testTriggerDeprecation($expected, DeprecatedCallableInfo $info)
{
$info->setType('function');
diff --git a/tests/LexerTest.php b/tests/LexerTest.php
index 839f156..a22a2fb 100644
--- a/tests/LexerTest.php
+++ b/tests/LexerTest.php
@@ -530,9 +530,7 @@ bar
$this->assertTrue($stream->isEOF());
}
- /**
- * @dataProvider getTemplateForInlineCommentsForVariable
- */
+ #[DataProvider('getTemplateForInlineCommentsForVariable')]
public function testInlineCommentForVariable(string $template)
{
$lexer = new Lexer(new Environment(new ArrayLoader()));
@@ -563,9 +561,7 @@ bar
}}'];
}
- /**
- * @dataProvider getTemplateForInlineCommentsForBlock
- */
+ #[DataProvider('getTemplateForInlineCommentsForBlock')]
public function testInlineCommentForBlock(string $template)
{
$lexer = new Lexer(new Environment(new ArrayLoader()));
@@ -601,9 +597,7 @@ bar
%}me{% endif %}'];
}
- /**
- * @dataProvider getTemplateForInlineCommentsForComment
- */
+ #[DataProvider('getTemplateForInlineCommentsForComment')]
public function testInlineCommentForComment(string $template)
{
$lexer = new Lexer(new Environment(new ArrayLoader()));
diff --git a/tests/Util/CallableArgumentsExtractorTest.php b/tests/Util/CallableArgumentsExtractorTest.php
index a06e19a..25e91c6 100644
--- a/tests/Util/CallableArgumentsExtractorTest.php
+++ b/tests/Util/CallableArgumentsExtractorTest.php
@@ -11,6 +11,7 @@ namespace Twig\Tests\Util;
* file that was distributed with this source code.
*/
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
use Twig\Error\SyntaxError;
@@ -86,9 +87,7 @@ class CallableArgumentsExtractorTest extends TestCase
$this->assertEquals(['arg1'], $this->getArguments('custom_static_function', __CLASS__.'::customStaticFunction', ['arg1' => 'arg1']));
}
- /**
- * @dataProvider getGetArgumentsConversionData
- */
+ #[DataProvider('getGetArgumentsConversionData')]
public function testGetArgumentsConversion($arg1, $arg2)
{
$this->assertEquals([null], $this->getArguments('custom', eval("return fn (\$$arg1) => '';"), [$arg1 => null]));
|