function ArgumentsResolverTest::testHandleNotUpcastedArgument

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testHandleNotUpcastedArgument()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testHandleNotUpcastedArgument()
  3. 10 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\ArgumentsResolverTest::testHandleNotUpcastedArgument()

Tests handleUnresolvedArgument() for a scalar argument.

File

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

Class

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

Namespace

Drupal\Tests\Component\Utility

Code

public function testHandleNotUpcastedArgument() : void {
    $objects = [
        'foo' => 'bar',
    ];
    $scalars = [
        'foo' => 'baz',
    ];
    $resolver = new ArgumentsResolver($scalars, $objects, []);
    $callable = function (\stdClass $foo) {
    };
    $this->expectException(\RuntimeException::class);
    $this->expectExceptionMessage('requires a value for the "$foo" argument.');
    $resolver->getArguments($callable);
}

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