function ArgumentsResolverTest::providerTestGetArgument
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::providerTestGetArgument()
- 8.9.x core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::providerTestGetArgument()
- 10 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::providerTestGetArgument()
Provides test data to testGetArgument().
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ ArgumentsResolverTest.php, line 36
Class
- ArgumentsResolverTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Component%21Utility%21ArgumentsResolver.php/class/ArgumentsResolver/11.x" title="Resolves the arguments to pass to a callable." class="local">\Drupal\Component\Utility\ArgumentsResolver</a> @group Access
Namespace
Drupal\Tests\Component\UtilityCode
public static function providerTestGetArgument() {
$data = [];
// Test an optional parameter with no provided value.
$data[] = [
function ($foo = 'foo') {
},
[],
[],
[],
[
'foo',
],
];
// Test an optional parameter with a provided value.
$data[] = [
function ($foo = 'foo') {
},
[
'foo' => 'bar',
],
[],
[],
[
'bar',
],
];
// Test with a provided value.
$data[] = [
function ($foo) {
},
[
'foo' => 'bar',
],
[],
[],
[
'bar',
],
];
// Test with an explicitly NULL value.
$data[] = [
function ($foo) {
},
[],
[
'foo' => NULL,
],
[],
[
NULL,
],
];
// Test with a raw value that overrides the provided upcast value, since
// it is not type hinted.
$scalars = [
'foo' => 'baz',
];
$objects = [
'foo' => new \stdClass(),
];
$data[] = [
function ($foo) {
},
$scalars,
$objects,
[],
[
'baz',
],
];
// Test a static method string.
$data[] = [
TestStaticMethodClass::class . "::access",
[],
[
'foo' => NULL,
],
[],
[
NULL,
],
];
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.