function ArgumentsResolverTest::testGetWildcardArgumentNoTypehint

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testGetWildcardArgumentNoTypehint()
  2. 10 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testGetWildcardArgumentNoTypeHint()
  3. 11.x 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

Class

ArgumentsResolverTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Component%21Utility%21ArgumentsResolver.php/class/ArgumentsResolver/9" title="Resolves the arguments to pass to a callable." class="local">\Drupal\Component\Utility\ArgumentsResolver</a> @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);
}

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