Skip to content

Commit 1d2ba99

Browse files
committed
Fix tests that use deprecated callable syntax
1 parent b0f37e0 commit 1d2ba99

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,25 @@ public function testDescribeCallable($callable, $expectedDescription)
208208
$this->assertDescription($expectedDescription, $callable);
209209
}
210210

211-
public function getDescribeCallableTestData()
211+
public function getDescribeCallableTestData(): array
212212
{
213213
return $this->getDescriptionTestData(ObjectsProvider::getCallables());
214214
}
215215

216+
/**
217+
* @group legacy
218+
* @dataProvider getDescribeDeprecatedCallableTestData
219+
*/
220+
public function testDescribeDeprecatedCallable($callable, $expectedDescription)
221+
{
222+
$this->assertDescription($expectedDescription, $callable);
223+
}
224+
225+
public function getDescribeDeprecatedCallableTestData(): array
226+
{
227+
return $this->getDescriptionTestData(ObjectsProvider::getDeprecatedCallables());
228+
}
229+
216230
/** @dataProvider getClassDescriptionTestData */
217231
public function testGetClassDescription($object, $expectedDescription)
218232
{

Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,19 +229,25 @@ public static function getEventDispatchers()
229229
return ['event_dispatcher_1' => $eventDispatcher];
230230
}
231231

232-
public static function getCallables()
232+
public static function getCallables(): array
233233
{
234234
return [
235235
'callable_1' => 'array_key_exists',
236236
'callable_2' => ['Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\CallableClass', 'staticMethod'],
237237
'callable_3' => [new CallableClass(), 'method'],
238238
'callable_4' => 'Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\CallableClass::staticMethod',
239-
'callable_5' => ['Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\ExtendedCallableClass', 'parent::staticMethod'],
240239
'callable_6' => function () { return 'Closure'; },
241240
'callable_7' => new CallableClass(),
242241
'callable_from_callable' => \Closure::fromCallable(new CallableClass()),
243242
];
244243
}
244+
245+
public static function getDeprecatedCallables(): array
246+
{
247+
return [
248+
'callable_5' => ['Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\ExtendedCallableClass', 'parent::staticMethod'],
249+
];
250+
}
245251
}
246252

247253
class CallableClass

0 commit comments

Comments
 (0)