You are here

public function ProxyBuilderTest::testBuildWithPublicStaticMethod in Drupal 8

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

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

File

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

Class

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

Namespace

Drupal\Tests\Component\ProxyBuilder

Code

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

  // Ensure that the static method is not wrapped.
  $method_body = <<<'EOS'

/**
 * {@inheritdoc}
 */
public static function testMethod($parameter)
{
    \Drupal\Tests\Component\ProxyBuilder\TestServiceWithPublicStaticMethod::testMethod($parameter);
}

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