function ArgumentsResolverTest::providerTestGetArgument
Same name in other branches
- 9 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()
- 11.x 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 39
Class
- ArgumentsResolverTest
- @coversDefaultClass \Drupal\Component\Utility\ArgumentsResolver @group Access
Namespace
Drupal\Tests\Component\UtilityCode
public 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 typehinted.
$scalars = [
'foo' => 'baz',
];
$objects = [
'foo' => new \stdClass(),
];
$data[] = [
function ($foo) {
},
$scalars,
$objects,
[],
[
'baz',
],
];
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.