function ProxyBuilderTest::testBuildWithProtectedAndPrivateMethod

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest::testBuildWithProtectedAndPrivateMethod()
  2. 9 core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest::testBuildWithProtectedAndPrivateMethod()
  3. 8.9.x core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest::testBuildWithProtectedAndPrivateMethod()

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

File

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

Class

ProxyBuilderTest
@coversDefaultClass \Drupal\Component\ProxyBuilder\ProxyBuilder[[api-linebreak]] @group proxy_builder

Namespace

Drupal\Tests\Component\ProxyBuilder

Code

public function testBuildWithProtectedAndPrivateMethod() : void {
  $class = 'Drupal\\Tests\\Component\\ProxyBuilder\\TestServiceWithProtectedMethods';
  $result = $this->proxyBuilder
    ->build($class);
  $method_body = <<<'EOS'
  
  /**
   * {@inheritdoc}
   */
  public function testMethod($parameter)
  {
      return $this->lazyLoadItself()->testMethod($parameter);
  }
  
  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.