You are here

public function ArgumentsResolverTest::testGetWildcardArgumentNoTypehint 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::testGetWildcardArgumentNoTypehint()

Tests getArgument() with a wildcard parameter with no typehint.

Without the typehint, the wildcard object will not be passed to the callable.

File

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

Class

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

Namespace

Drupal\Tests\Component\Utility

Code

public function testGetWildcardArgumentNoTypehint() {
  $a = $this
    ->getMockBuilder('\\Drupal\\Tests\\Component\\Utility\\Test1Interface')
    ->getMock();
  $wildcards = [
    $a,
  ];
  $resolver = new ArgumentsResolver([], [], $wildcards);
  $callable = function ($route) {
  };
  $this
    ->expectException(\RuntimeException::class);
  $this
    ->expectExceptionMessage('requires a value for the "$route" argument.');
  $resolver
    ->getArguments($callable);
}