feature #4265 Migrate NodeTestCase to static data providers (derrabus)

This PR was merged into the 3.x branch.

Discussion
----------

Migrate NodeTestCase to static data providers

PHPUnit 11 requires data providers to be static. This PR prepares our abstract `NodeTestCase` by deprecating the non-static `getTests()` and adding a static `provideTests()` as a replacement. I've also added PHPUnit attributes which newer PHPUnit releases prefer over PHPDoc annotations.

Commits
-------

f555a33c Migrate NodeTestCase to static data providers
This commit is contained in:
Fabien Potencier
2024-09-03 14:03:04 +02:00
43 changed files with 209 additions and 145 deletions
+1 -3
View File
@@ -23,8 +23,6 @@ use Twig\Node\Node;
use Twig\Node\SetNode;
use Twig\Node\TextNode;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
use Twig\Test\NodeTestCase;
class ModuleTest extends NodeTestCase
@@ -46,7 +44,7 @@ class ModuleTest extends NodeTestCase
$this->assertEquals($source->getName(), $node->getTemplateName());
}
public function getTests()
public static function provideTests(): iterable
{
$twig = new Environment(new ArrayLoader(['foo.twig' => '{{ foo }}']));