You are here

public function ProxyBuilderTest::testBuildMethodWithParameter 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::testBuildMethodWithParameter()
  2. 10 core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest::testBuildMethodWithParameter()

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

File

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

Class

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

Namespace

Drupal\Tests\Component\ProxyBuilder

Code

public function testBuildMethodWithParameter() {
  $class = 'Drupal\\Tests\\Component\\ProxyBuilder\\TestServiceMethodWithParameter';
  $result = $this->proxyBuilder
    ->build($class);
  $method_body = <<<'EOS'

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

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