function ProxyBuilderTest::testBuildComplexMethod

Same name in this branch
  1. 11.x core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Core\ProxyBuilder\ProxyBuilderTest::testBuildComplexMethod()
Same name in other branches
  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()
  3. 8.9.x core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Core\ProxyBuilder\ProxyBuilderTest::testBuildComplexMethod()
  4. 8.9.x core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest::testBuildComplexMethod()
  5. 10 core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Core\ProxyBuilder\ProxyBuilderTest::testBuildComplexMethod()
  6. 10 core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest::testBuildComplexMethod()

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

File

core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php, line 122

Class

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

Namespace

Drupal\Tests\Component\ProxyBuilder

Code

public function testBuildComplexMethod() : void {
    $class = 'Drupal\\Tests\\Component\\ProxyBuilder\\TestServiceComplexMethod';
    $result = $this->proxyBuilder
        ->build($class);
    // @todo Solve the silly linebreak for array()
    $method_body = <<<'EOS'

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

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

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