ProxyBuilder example

if (PHP_SAPI !== 'cli') {
  return;
}

// Bootstrap. $autoloader = require __DIR__ . '/../../autoload.php';
$request = Request::createFromGlobals();
Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request)$autoloader);
DrupalKernel::createFromRequest($request$autoloader, 'prod')->boot();

// Run the database dump command. $application = new GenerateProxyClassApplication(new ProxyBuilder());
$application->run();

  protected $proxyBuilder;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->proxyBuilder = new ProxyBuilder();
  }

  /** * @covers ::buildMethod * @covers ::buildParameter * @covers ::buildMethodBody */
  public function testBuildComplexMethod() {
    $class = 'Drupal\Tests\Core\ProxyBuilder\TestServiceComplexMethod';

    $result = $this->proxyBuilder->build($class);

    

  protected $proxyBuilder;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->proxyBuilder = new ProxyBuilder();
  }

  /** * @covers ::buildProxyClassName */
  public function testBuildProxyClassName() {
    $class_name = $this->proxyBuilder->buildProxyClassName('Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod');
    $this->assertEquals('Drupal\Tests\ProxyClass\Component\ProxyBuilder\TestServiceNoMethod', $class_name);
  }

  /** * @covers ::buildProxyClassName */
Home | Imprint | This part of the site doesn't use cookies.