final class Generator (View source)

internal  This class is not covered by the backward compatibility promise for PHPUnit
 

Traits

Methods

testDouble(string $type, bool $mockObject, array|null $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $returnValueGeneration = true)

Returns a test double for the specified class.

testDoubleForInterfaceIntersection(array $interfaces, bool $mockObject, bool $returnValueGeneration = true)

No description

generate(string $type, bool $mockObject, array|null $methods = null, string $mockClassName = '', bool $callOriginalClone = true)

No description

Details

MockObject|Stub testDouble(string $type, bool $mockObject, array|null $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $returnValueGeneration = true)

Returns a test double for the specified class.

Parameters

string $type
bool $mockObject
array|null $methods
array $arguments
string $mockClassName
bool $callOriginalConstructor
bool $callOriginalClone
bool $returnValueGeneration

Return Value

MockObject|Stub

Exceptions

ClassIsEnumerationException
ClassIsFinalException
DuplicateMethodException
InvalidMethodNameException
NameAlreadyInUseException
ReflectionException
RuntimeException
UnknownTypeException

MockObject|Stub testDoubleForInterfaceIntersection(array $interfaces, bool $mockObject, bool $returnValueGeneration = true)

No description

Parameters

array $interfaces
bool $mockObject
bool $returnValueGeneration

Return Value

MockObject|Stub

Exceptions

RuntimeException
UnknownInterfaceException

DoubledClass generate(string $type, bool $mockObject, array|null $methods = null, string $mockClassName = '', bool $callOriginalClone = true)

No description

This method is only public because it is used to test generated code in PHPT tests

Parameters

string $type
bool $mockObject
array|null $methods
string $mockClassName
bool $callOriginalClone

Return Value

DoubledClass

Exceptions

ClassIsEnumerationException
ClassIsFinalException
ReflectionException
RuntimeException

See also

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