You are here

public function ArgumentsResolverTest::testGetArgumentRouteNoTypehintAndValue in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testGetArgumentRouteNoTypehintAndValue()

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

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

File

core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php, line 142
Contains \Drupal\Tests\Component\Utility\ArgumentsResolverTest.

Class

ArgumentsResolverTest
@coversDefaultClass \Drupal\Component\Utility\ArgumentsResolver @group Access

Namespace

Drupal\Tests\Component\Utility

Code

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