You are here

public function ProxyBuilderTest::testBuildReturnReference in Drupal 9

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

@covers ::buildMethod @covers ::buildMethodBody

File

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

Class

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

Namespace

Drupal\Tests\Component\ProxyBuilder

Code

public function testBuildReturnReference() {
  $class = 'Drupal\\Tests\\Component\\ProxyBuilder\\TestServiceReturnReference';
  $result = $this->proxyBuilder
    ->build($class);

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

/**
 * {@inheritdoc}
 */
public function &returnReference()
{
    return $this->lazyLoadItself()->returnReference();
}

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