function ArgumentsResolverTest::testGetArgumentRouteNoTypeHintAndValue

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testGetArgumentRouteNoTypeHintAndValue()
  2. 9 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testGetArgumentRouteNoTypehintAndValue()
  3. 8.9.x core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testGetArgumentRouteNoTypehintAndValue()
  4. main core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testGetArgumentRouteNoTypeHintAndValue()

Tests getArgument() with a named parameter with no type hint and a value.

Without the type hint, passing a value to a named parameter will still receive the provided value.

File

core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php, line 145

Class

ArgumentsResolverTest
Tests Drupal\Component\Utility\ArgumentsResolver.

Namespace

Drupal\Tests\Component\Utility

Code

public function testGetArgumentRouteNoTypeHintAndValue() : void {
  $scalars = [
    'route' => 'foo',
  ];
  $resolver = new ArgumentsResolver($scalars, [], []);
  $callable = function ($route) : void {
  };
  $arguments = $resolver->getArguments($callable);
  $this->assertSame([
    'foo',
  ], $arguments);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.