• psalm-template MockedType
CloneableFinalInstantiable
Methods
public __construct(PHPUnit\Framework\TestCase $testCase, $type)
 
  • psalm-param class-string|string|string[] $type
public addMethods(array $methods) : self
 

Specifies methods that don't exist in the class which you want to mock

  • throws RuntimeException
public allowMockingUnknownTypes() : self
public disableArgumentCloning() : self
 

Disables the cloning of arguments passed to mocked methods.

public disableAutoload() : self
 

Disables the use of class autoloading while creating the mock object.

public disableAutoReturnValueGeneration() : self
public disableOriginalClone() : self
 

Disables the invocation of the original clone constructor.

public disableOriginalConstructor() : self
 

Disables the invocation of the original constructor.

public disableProxyingToOriginalMethods() : self
 

Disables the invocation of the original methods.

public disallowMockingUnknownTypes() : self
public enableArgumentCloning() : self
 

Enables the cloning of arguments passed to mocked methods.

public enableAutoload() : self
 

Enables the use of class autoloading while creating the mock object.

public enableAutoReturnValueGeneration() : self
public enableOriginalClone() : self
 

Enables the invocation of the original clone constructor.

public enableOriginalConstructor() : self
 

Enables the invocation of the original constructor.

public enableProxyingToOriginalMethods() : self
 

Enables the invocation of the original methods.

public getMock() : PHPUnit\Framework\MockObject\MockObject
 

Creates a mock object using a fluent interface.

  • throws RuntimeException
  • psalm-return MockObject&MockedType
public getMockForAbstractClass() : PHPUnit\Framework\MockObject\MockObject
 

Creates a mock object for an abstract class using a fluent interface.

  • throws PHPUnit\Framework\Exception
  • throws RuntimeException
  • psalm-return MockObject&MockedType
public getMockForTrait() : PHPUnit\Framework\MockObject\MockObject
 

Creates a mock object for a trait using a fluent interface.

  • throws PHPUnit\Framework\Exception
  • throws RuntimeException
  • psalm-return MockObject&MockedType
public onlyMethods(array $methods) : self
 

Specifies the subset of methods to mock, requiring each to exist in the class

  • throws RuntimeException
public setConstructorArgs(array $args) : self
 

Specifies the arguments for the constructor.

public setMethods(?array $methods = NULL) : self
 

Specifies the subset of methods to mock. Default is to mock none of them.

  • deprecated https://github.com/sebastianbergmann/phpunit/pull/3687
public setMethodsExcept(array $methods = []) : self
 

Specifies the subset of methods to not mock. Default is to mock all of them.

public setMockClassName(string $name) : self
 

Specifies the name for the mock class.

public setProxyTarget(object $object) : self
 

Sets the proxy target.

Properties
private $allowMockingUnknownTypes
 
  • var bool
private $autoload
 
  • var bool
private $callOriginalMethods
 
  • var bool
private $cloneArguments
 
  • var bool
private $constructorArgs
 
  • var array
private $emptyMethodsArray
 
  • var bool
private $generator
private $methods
 
  • var null|string[]
private $mockClassName
 
  • var string
private $originalClone
 
  • var bool
private $originalConstructor
 
  • var bool
private $proxyTarget
 
  • var ?object
private $returnValueGeneration
 
  • var bool
private $testCase
 
  • var TestCase
private $type
 
  • var string
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only