Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Fix tests that use deprecated callable syntax #46970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,25 @@ public function testDescribeCallable($callable, $expectedDescription)
$this->assertDescription($expectedDescription, $callable);
}

public function getDescribeCallableTestData()
public function getDescribeCallableTestData(): array
{
return $this->getDescriptionTestData(ObjectsProvider::getCallables());
}

/**
* @group legacy
* @dataProvider getDescribeDeprecatedCallableTestData
*/
public function testDescribeDeprecatedCallable($callable, $expectedDescription)
{
$this->assertDescription($expectedDescription, $callable);
}

public function getDescribeDeprecatedCallableTestData(): array
{
return $this->getDescriptionTestData(ObjectsProvider::getDeprecatedCallables());
}

/** @dataProvider getClassDescriptionTestData */
public function testGetClassDescription($object, $expectedDescription)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,25 @@ public static function getEventDispatchers()
return ['event_dispatcher_1' => $eventDispatcher];
}

public static function getCallables()
public static function getCallables(): array
{
return [
'callable_1' => 'array_key_exists',
'callable_2' => ['Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\CallableClass', 'staticMethod'],
'callable_3' => [new CallableClass(), 'method'],
'callable_4' => 'Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\CallableClass::staticMethod',
'callable_5' => ['Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\ExtendedCallableClass', 'parent::staticMethod'],
'callable_6' => function () { return 'Closure'; },
'callable_7' => new CallableClass(),
'callable_from_callable' => \Closure::fromCallable(new CallableClass()),
];
}

public static function getDeprecatedCallables(): array
{
return [
'callable_5' => ['Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\ExtendedCallableClass', 'parent::staticMethod'],
];
}
}

class CallableClass
Expand Down