Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TestCase.php

function TestCase::createTestProxy

Creates a test proxy for the specified class.

@psalm-template RealInstanceType of object

@psalm-param class-string<RealInstanceType> $originalClassName

@psalm-return MockObject&RealInstanceType

Throws

InvalidArgumentException

MockObjectException

Deprecated

https://github.com/sebastianbergmann/phpunit/issues/5240

File

vendor/phpunit/phpunit/src/Framework/TestCase.php, line 1393

Class

TestCase
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\Framework

Code

protected function createTestProxy(string $originalClassName, array $constructorArguments = []) : MockObject {
    $testProxy = $this->getMockBuilder($originalClassName)
        ->setConstructorArgs($constructorArguments)
        ->enableProxyingToOriginalMethods()
        ->getMock();
    Event\Facade::emitter()->testCreatedTestProxy($originalClassName, $constructorArguments);
    return $testProxy;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal