Skip to content

Commit

Permalink
Fix deprecated testing methods: getTests is now provideTests and getV…
Browse files Browse the repository at this point in the history
…ariableGetter is now createVariableGetter

Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Jan 10, 2025
1 parent 3d8c24f commit 43e6f43
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
26 changes: 13 additions & 13 deletions test/Node/MoTranslatorTransTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public function testFullConstructor(): void
$this->assertEquals($context, $node->getNode('context'));
}

/** @return mixed[] */
public function getTests(): array
/** @return iterable<array{0: \Twig\Node\Node, 1: string, 2?: Environment|null, 3?: bool}> */
public static function provideTests(): iterable

Check failure on line 74 in test/Node/MoTranslatorTransTest.php

View workflow job for this annotation

GitHub Actions / analyse-php

Method PhpMyAdmin\Tests\Twig\Extensions\Node\MoTranslatorTransTest::provideTests() has invalid return type PhpMyAdmin\Tests\Twig\Extensions\Node\Environment.

Check failure on line 74 in test/Node/MoTranslatorTransTest.php

View workflow job for this annotation

GitHub Actions / analyse-php

Return type (iterable<array{0: Twig\Node\Node, 1: string, 2?: PhpMyAdmin\Tests\Twig\Extensions\Node\Environment|null, 3?: bool}>) of method PhpMyAdmin\Tests\Twig\Extensions\Node\MoTranslatorTransTest::provideTests() should be covariant with return type (iterable<array{0: Twig\Node\Node, 1: string, 2?: Twig\Environment|null, 3?: bool}>) of method Twig\Test\NodeTestCase::provideTests()
{
$tests = [];

Expand All @@ -82,7 +82,7 @@ public function getTests(): array
$node = new TransNode($body, null, null, null, null, $domain, 0);
$tests[] = [
$node,
sprintf('yield _dgettext("coredomain", %s);', $this->getVariableGetter('foo')),
sprintf('yield _dgettext("coredomain", %s);', self::createVariableGetter('foo')),
];

$body = new ContextVariable('foo', 0);
Expand All @@ -97,7 +97,7 @@ public function getTests(): array
$node,
sprintf(
'yield _dpgettext("coredomain", "The context", %s);',
$this->getVariableGetter('foo'),
self::createVariableGetter('foo'),
),
];

Expand All @@ -111,7 +111,7 @@ public function getTests(): array
$node,
sprintf(
'yield strtr(_gettext("J\'ai %%foo%% pommes"), array("%%foo%%" => %s, ));',
$this->getVariableGetter('foo'),
self::createVariableGetter('foo'),
),
];

Expand All @@ -135,8 +135,8 @@ public function getTests(): array
'yield strtr(_ngettext("Hey %%name%%, I have one apple", "Hey %%name%%,'
. ' I have %%count%% apples", abs(12)), array("%%name%%" => %s,'
. ' "%%name%%" => %s, "%%count%%" => abs(12), ));',
$this->getVariableGetter('name'),
$this->getVariableGetter('name'),
self::createVariableGetter('name'),
self::createVariableGetter('name'),
),
];

Expand All @@ -153,7 +153,7 @@ public function getTests(): array
$node,
sprintf(
'yield strtr(_pgettext("The context", "J\'ai %%foo%% pommes"), array("%%foo%%" => %s, ));',
$this->getVariableGetter('foo'),
self::createVariableGetter('foo'),
),
];

Expand All @@ -180,8 +180,8 @@ public function getTests(): array
'yield strtr(_npgettext("The context", "Hey %%name%%, I have one apple", "Hey %%name%%,'
. ' I have %%count%% apples", abs(12)), array("%%name%%" => %s,'
. ' "%%name%%" => %s, "%%count%%" => abs(12), ));',
$this->getVariableGetter('name'),
$this->getVariableGetter('name'),
self::createVariableGetter('name'),
self::createVariableGetter('name'),
),
];

Expand All @@ -201,7 +201,7 @@ public function getTests(): array
$node,
sprintf(
'yield strtr(_dpgettext("mydomain", "The context", "J\'ai %%foo%% pommes"), array("%%foo%%" => %s, ));',
$this->getVariableGetter('foo'),
self::createVariableGetter('foo'),
),
];

Expand Down Expand Up @@ -231,8 +231,8 @@ public function getTests(): array
'yield strtr(_dnpgettext("mydomain", "The context", "Hey %%name%%, I have one apple",'
. ' "Hey %%name%%, I have %%count%% apples", abs(12)), array("%%name%%" => %s,'
. ' "%%name%%" => %s, "%%count%%" => abs(12), ));',
$this->getVariableGetter('name'),
$this->getVariableGetter('name'),
self::createVariableGetter('name'),
self::createVariableGetter('name'),
),
];

Expand Down
16 changes: 8 additions & 8 deletions test/Node/TransTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public function testEnableDebugEnabled(): void
TransNode::$notesLabel = '// notes: ';
}

/** @return mixed[] */
public function getTests(): array
/** @return iterable<array{0: \Twig\Node\Node, 1: string, 2?: Environment|null, 3?: bool}> */
public static function provideTests(): iterable

Check failure on line 132 in test/Node/TransTest.php

View workflow job for this annotation

GitHub Actions / analyse-php

Method PhpMyAdmin\Tests\Twig\Extensions\Node\TransTest::provideTests() has invalid return type PhpMyAdmin\Tests\Twig\Extensions\Node\Environment.

Check failure on line 132 in test/Node/TransTest.php

View workflow job for this annotation

GitHub Actions / analyse-php

Return type (iterable<array{0: Twig\Node\Node, 1: string, 2?: PhpMyAdmin\Tests\Twig\Extensions\Node\Environment|null, 3?: bool}>) of method PhpMyAdmin\Tests\Twig\Extensions\Node\TransTest::provideTests() should be covariant with return type (iterable<array{0: Twig\Node\Node, 1: string, 2?: Twig\Environment|null, 3?: bool}>) of method Twig\Test\NodeTestCase::provideTests()
{
$tests = [];

Expand All @@ -140,12 +140,12 @@ public function getTests(): array
$node = new TransNode($body, null, null, null, null, $domain, 0);
$tests[] = [
$node,
sprintf('yield dgettext("coredomain", %s);', $this->getVariableGetter('foo')),
sprintf('yield dgettext("coredomain", %s);', self::createVariableGetter('foo')),
];

$body = new ContextVariable('foo', 0);
$node = new TransNode($body, null, null, null, null, null, 0);
$tests[] = [$node, sprintf('yield gettext(%s);', $this->getVariableGetter('foo'))];
$tests[] = [$node, sprintf('yield gettext(%s);', self::createVariableGetter('foo'))];

$body = new ConstantExpression('Hello', 0);
$node = new TransNode($body, null, null, null, null, null, 0);
Expand All @@ -167,7 +167,7 @@ public function getTests(): array
$node,
sprintf(
'yield strtr(gettext("J\'ai %%foo%% pommes"), array("%%foo%%" => %s, ));',
$this->getVariableGetter('foo'),
self::createVariableGetter('foo'),
),
];

Expand All @@ -191,8 +191,8 @@ public function getTests(): array
'yield strtr(ngettext("Hey %%name%%, I have one apple", "Hey %%name%%, I have'
. ' %%count%% apples", abs(12)), array("%%name%%" => %s,'
. ' "%%name%%" => %s, "%%count%%" => abs(12), ));',
$this->getVariableGetter('name'),
$this->getVariableGetter('name'),
self::createVariableGetter('name'),
self::createVariableGetter('name'),
),
];

Expand All @@ -212,7 +212,7 @@ public function getTests(): array
$node,
sprintf(
'yield strtr(gettext("J\'ai %%foo%% pommes"), array("%%foo%%" => %s, ));',
$this->getVariableGetter('foo'),
self::createVariableGetter('foo'),
),
];

Expand Down

0 comments on commit 43e6f43

Please sign in to comment.