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
|
From: "Alexander M. Turek" <me@derrabus.de>
Date: Tue, 3 Sep 2024 22:48:59 +0200
Subject: Switch to static data provides for integration tests
Origin: upstream, https://github.com/twigphp/twig/commit/9282dbcc42b897b4f3c4dacbd767d1e7b1ff1b75
Bug-Debian: https://bugs.debian.org/1039841
---
src/Test/IntegrationTestCase.php | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/Test/IntegrationTestCase.php b/src/Test/IntegrationTestCase.php
index f3f7adc..dd54475 100644
--- a/src/Test/IntegrationTestCase.php
+++ b/src/Test/IntegrationTestCase.php
@@ -11,6 +11,9 @@
namespace Twig\Test;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
+use PHPUnit\Framework\Constraint\Exception;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Error\Error;
@@ -114,6 +117,7 @@ abstract class IntegrationTestCase extends TestCase
*
* @return void
*/
+ #[DataProvider('getTests')]
public function testIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '')
{
$this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation);
@@ -126,17 +130,13 @@ abstract class IntegrationTestCase extends TestCase
*
* @return void
*/
+ #[DataProvider('getLegacyTests'), IgnoreDeprecations]
public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '')
{
$this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation);
}
- /**
- * @return iterable
- *
- * @final since Twig 3.13
- */
- public function getTests($name, $legacyTests = false)
+ private static function assembleTests(bool $legacyTests): array
{
try {
$fixturesDir = static::getFixturesDirectory();
@@ -188,14 +188,14 @@ abstract class IntegrationTestCase extends TestCase
return $tests;
}
- /**
- * @final since Twig 3.13
- *
- * @return iterable
- */
- public function getLegacyTests()
+ final public static function getTests(): array
+ {
+ return self::assembleTests(false);
+ }
+
+ final public static function getLegacyTests(): array
{
- return $this->getTests('testLegacyIntegration', true);
+ return self::assembleTests(true);
}
/**
|