You are here

public function ProxyBuilderTest::testBuildServiceMethodReturnsVoid in Drupal 9

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest::testBuildServiceMethodReturnsVoid()

@covers ::buildMethodBody

File

core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php, line 150
Contains \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest.

Class

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

Namespace

Drupal\Tests\Component\ProxyBuilder

Code

public function testBuildServiceMethodReturnsVoid() {
  $class = TestServiceMethodReturnsVoid::class;
  $result = $this->proxyBuilder
    ->build($class);

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

/**
 * {@inheritdoc}
 */
public function methodReturnsVoid(string $parameter): void
{
    $this->lazyLoadItself()->methodReturnsVoid($parameter);
}

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