final class MockBuilder extends TestDoubleBuilder (View source)

Properties

protected class-string|trait-string $type from  TestDoubleBuilder
protected list<non-empty-string> $methods from  TestDoubleBuilder
protected bool $emptyMethodsArray from  TestDoubleBuilder
protected array $constructorArgs from  TestDoubleBuilder
protected bool $originalConstructor from  TestDoubleBuilder
protected bool $originalClone from  TestDoubleBuilder
protected bool $returnValueGeneration from  TestDoubleBuilder

Methods

__construct(TestCase $testCase, string $type)

No description

onlyMethods(array $methods)

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

setConstructorArgs(array $arguments)

Specifies the arguments for the constructor.

disableOriginalConstructor()

Disables the invocation of the original constructor.

enableOriginalConstructor()

Enables the invocation of the original constructor.

disableOriginalClone()

Disables the invocation of the original clone constructor.

enableOriginalClone()

Enables the invocation of the original clone constructor.

getTestDouble(string|null $testDoubleClassName, bool $mockObject)

No description

getMock()

Creates a mock object using a fluent interface.

setMockClassName(string $name)

Specifies the name for the mock class.

Details

__construct(TestCase $testCase, string $type)

No description

Parameters

TestCase $testCase
string $type

TestDoubleBuilder onlyMethods(array $methods)

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

Parameters

array $methods

Return Value

TestDoubleBuilder

Exceptions

CannotUseOnlyMethodsException
ReflectionException

TestDoubleBuilder setConstructorArgs(array $arguments)

Specifies the arguments for the constructor.

Parameters

array $arguments

Return Value

TestDoubleBuilder

TestDoubleBuilder disableOriginalConstructor()

Disables the invocation of the original constructor.

Return Value

TestDoubleBuilder

TestDoubleBuilder enableOriginalConstructor()

Enables the invocation of the original constructor.

Return Value

TestDoubleBuilder

TestDoubleBuilder disableOriginalClone()

Disables the invocation of the original clone constructor.

Return Value

TestDoubleBuilder

TestDoubleBuilder enableOriginalClone()

Enables the invocation of the original clone constructor.

Return Value

TestDoubleBuilder

TestDoubleBuilder enableAutoReturnValueGeneration()

No description

Return Value

TestDoubleBuilder

TestDoubleBuilder disableAutoReturnValueGeneration()

No description

Return Value

TestDoubleBuilder

protected MockObject|Stub getTestDouble(string|null $testDoubleClassName, bool $mockObject)

No description

Parameters

string|null $testDoubleClassName
bool $mockObject

Return Value

MockObject|Stub

MockBuilder setMockClassName(string $name)

Specifies the name for the mock class.

Parameters

string $name

Return Value

MockBuilder