Skip to content

Commit 43e6f43

Browse files
committed
Fix deprecated testing methods: getTests is now provideTests and getVariableGetter is now createVariableGetter
Signed-off-by: William Desportes <[email protected]>
1 parent 3d8c24f commit 43e6f43

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

test/Node/MoTranslatorTransTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public function testFullConstructor(): void
7070
$this->assertEquals($context, $node->getNode('context'));
7171
}
7272

73-
/** @return mixed[] */
74-
public function getTests(): array
73+
/** @return iterable<array{0: \Twig\Node\Node, 1: string, 2?: Environment|null, 3?: bool}> */
74+
public static function provideTests(): iterable
7575
{
7676
$tests = [];
7777

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

8888
$body = new ContextVariable('foo', 0);
@@ -97,7 +97,7 @@ public function getTests(): array
9797
$node,
9898
sprintf(
9999
'yield _dpgettext("coredomain", "The context", %s);',
100-
$this->getVariableGetter('foo'),
100+
self::createVariableGetter('foo'),
101101
),
102102
];
103103

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

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

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

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

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

@@ -231,8 +231,8 @@ public function getTests(): array
231231
'yield strtr(_dnpgettext("mydomain", "The context", "Hey %%name%%, I have one apple",'
232232
. ' "Hey %%name%%, I have %%count%% apples", abs(12)), array("%%name%%" => %s,'
233233
. ' "%%name%%" => %s, "%%count%%" => abs(12), ));',
234-
$this->getVariableGetter('name'),
235-
$this->getVariableGetter('name'),
234+
self::createVariableGetter('name'),
235+
self::createVariableGetter('name'),
236236
),
237237
];
238238

test/Node/TransTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ public function testEnableDebugEnabled(): void
128128
TransNode::$notesLabel = '// notes: ';
129129
}
130130

131-
/** @return mixed[] */
132-
public function getTests(): array
131+
/** @return iterable<array{0: \Twig\Node\Node, 1: string, 2?: Environment|null, 3?: bool}> */
132+
public static function provideTests(): iterable
133133
{
134134
$tests = [];
135135

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

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

150150
$body = new ConstantExpression('Hello', 0);
151151
$node = new TransNode($body, null, null, null, null, null, 0);
@@ -167,7 +167,7 @@ public function getTests(): array
167167
$node,
168168
sprintf(
169169
'yield strtr(gettext("J\'ai %%foo%% pommes"), array("%%foo%%" => %s, ));',
170-
$this->getVariableGetter('foo'),
170+
self::createVariableGetter('foo'),
171171
),
172172
];
173173

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

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

0 commit comments

Comments
 (0)