You are here

public function ProxyBuilderTest::testBuildComplexMethod in Drupal 9

Same name in this branch
  1. 9 core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Core\ProxyBuilder\ProxyBuilderTest::testBuildComplexMethod()
  2. 9 core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest::testBuildComplexMethod()
Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Core\ProxyBuilder\ProxyBuilderTest::testBuildComplexMethod()

@covers ::buildMethod @covers ::buildParameter @covers ::buildMethodBody

File

core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php, line 40
Contains \Drupal\Tests\Core\ProxyBuilder\ProxyBuilderTest.

Class

ProxyBuilderTest
@coversDefaultClass \Drupal\Core\ProxyBuilder\ProxyBuilder @group proxy_builder

Namespace

Drupal\Tests\Core\ProxyBuilder

Code

public function testBuildComplexMethod() {
  $class = 'Drupal\\Tests\\Core\\ProxyBuilder\\TestServiceComplexMethod';
  $result = $this->proxyBuilder
    ->build($class);

  // @todo Solve the silly linebreak for array()
  $method_body = <<<'EOS'

/**
 * {@inheritdoc}
 */
public function complexMethod($parameter, callable $function, ?\Drupal\Tests\Core\ProxyBuilder\TestServiceNoMethod $test_service = NULL, array &$elements = array (
))
{
    return $this->lazyLoadItself()->complexMethod($parameter, $function, $test_service, $elements);
}

EOS;
  $this
    ->assertEquals($this
    ->buildExpectedClass($class, $method_body), $result);
}