diff --git a/test/Node/MoTranslatorTransTest.php b/test/Node/MoTranslatorTransTest.php index ff8d39f..22a72d6 100644 --- a/test/Node/MoTranslatorTransTest.php +++ b/test/Node/MoTranslatorTransTest.php @@ -70,8 +70,8 @@ public function testFullConstructor(): void $this->assertEquals($context, $node->getNode('context')); } - /** @return mixed[] */ - public function getTests(): array + /** @return iterable */ + public static function provideTests(): iterable { $tests = []; @@ -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); @@ -97,7 +97,7 @@ public function getTests(): array $node, sprintf( 'yield _dpgettext("coredomain", "The context", %s);', - $this->getVariableGetter('foo'), + self::createVariableGetter('foo'), ), ]; @@ -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'), ), ]; @@ -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'), ), ]; @@ -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'), ), ]; @@ -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'), ), ]; @@ -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'), ), ]; @@ -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'), ), ]; diff --git a/test/Node/TransTest.php b/test/Node/TransTest.php index 2bddca0..36b5a4f 100644 --- a/test/Node/TransTest.php +++ b/test/Node/TransTest.php @@ -128,8 +128,8 @@ public function testEnableDebugEnabled(): void TransNode::$notesLabel = '// notes: '; } - /** @return mixed[] */ - public function getTests(): array + /** @return iterable */ + public static function provideTests(): iterable { $tests = []; @@ -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); @@ -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'), ), ]; @@ -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'), ), ]; @@ -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'), ), ];