MockBuilder
in package
Tags
Table of Contents
Properties
- $allowMockingUnknownTypes : bool
- $autoload : bool
- $callOriginalMethods : bool
- $cloneArguments : bool
- $constructorArgs : array<string|int, mixed>
- $emptyMethodsArray : bool
- $generator : Generator
- $methods : array<string|int, mixed>
- $mockClassName : string|null
- $originalClone : bool
- $originalConstructor : bool
- $proxyTarget : object|null
- $returnValueGeneration : bool
- $testCase : TestCase
- $type : string
Methods
- __construct() : mixed
- addMethods() : $this
- Specifies methods that don't exist in the class which you want to mock.
- allowMockingUnknownTypes() : $this
- disableArgumentCloning() : $this
- Disables the cloning of arguments passed to mocked methods.
- disableAutoload() : $this
- Disables the use of class autoloading while creating the mock object.
- disableAutoReturnValueGeneration() : $this
- disableOriginalClone() : $this
- Disables the invocation of the original clone constructor.
- disableOriginalConstructor() : $this
- Disables the invocation of the original constructor.
- disableProxyingToOriginalMethods() : $this
- Disables the invocation of the original methods.
- disallowMockingUnknownTypes() : $this
- enableArgumentCloning() : $this
- Enables the cloning of arguments passed to mocked methods.
- enableAutoload() : $this
- Enables the use of class autoloading while creating the mock object.
- enableAutoReturnValueGeneration() : $this
- enableOriginalClone() : $this
- Enables the invocation of the original clone constructor.
- enableOriginalConstructor() : $this
- Enables the invocation of the original constructor.
- enableProxyingToOriginalMethods() : $this
- Enables the invocation of the original methods.
- getMock() : MockObject
- Creates a mock object using a fluent interface.
- getMockForAbstractClass() : MockObject
- Creates a mock object for an abstract class using a fluent interface.
- getMockForTrait() : MockObject
- Creates a mock object for a trait using a fluent interface.
- onlyMethods() : $this
- Specifies the subset of methods to mock, requiring each to exist in the class.
- setConstructorArgs() : $this
- Specifies the arguments for the constructor.
- setMockClassName() : $this
- Specifies the name for the mock class.
- setProxyTarget() : $this
- Sets the proxy target.
Properties
$allowMockingUnknownTypes
private
bool
$allowMockingUnknownTypes
= true
$autoload
private
bool
$autoload
= true
$callOriginalMethods
private
bool
$callOriginalMethods
= false
$cloneArguments
private
bool
$cloneArguments
= false
$constructorArgs
private
array<string|int, mixed>
$constructorArgs
= []
$emptyMethodsArray
private
bool
$emptyMethodsArray
= false
$generator read-only
private
Generator
$generator
$methods
private
array<string|int, mixed>
$methods
= []
Tags
$mockClassName
private
string|null
$mockClassName
= null
Tags
$originalClone
private
bool
$originalClone
= true
$originalConstructor
private
bool
$originalConstructor
= true
$proxyTarget
private
object|null
$proxyTarget
= null
$returnValueGeneration
private
bool
$returnValueGeneration
= true
$testCase read-only
private
TestCase
$testCase
$type read-only
private
string
$type
Tags
Methods
__construct()
public
__construct(TestCase $testCase, string $type) : mixed
Parameters
- $testCase : TestCase
- $type : string
Tags
addMethods()
Specifies methods that don't exist in the class which you want to mock.
public
addMethods(array<string|int, mixed> $methods) : $this
Parameters
- $methods : array<string|int, mixed>
Tags
Return values
$thisallowMockingUnknownTypes()
public
allowMockingUnknownTypes() : $this
Tags
Return values
$thisdisableArgumentCloning()
Disables the cloning of arguments passed to mocked methods.
public
disableArgumentCloning() : $this
Tags
Return values
$thisdisableAutoload()
Disables the use of class autoloading while creating the mock object.
public
disableAutoload() : $this
Tags
Return values
$thisdisableAutoReturnValueGeneration()
public
disableAutoReturnValueGeneration() : $this
Return values
$thisdisableOriginalClone()
Disables the invocation of the original clone constructor.
public
disableOriginalClone() : $this
Return values
$thisdisableOriginalConstructor()
Disables the invocation of the original constructor.
public
disableOriginalConstructor() : $this
Return values
$thisdisableProxyingToOriginalMethods()
Disables the invocation of the original methods.
public
disableProxyingToOriginalMethods() : $this
Tags
Return values
$thisdisallowMockingUnknownTypes()
public
disallowMockingUnknownTypes() : $this
Tags
Return values
$thisenableArgumentCloning()
Enables the cloning of arguments passed to mocked methods.
public
enableArgumentCloning() : $this
Tags
Return values
$thisenableAutoload()
Enables the use of class autoloading while creating the mock object.
public
enableAutoload() : $this
Tags
Return values
$thisenableAutoReturnValueGeneration()
public
enableAutoReturnValueGeneration() : $this
Return values
$thisenableOriginalClone()
Enables the invocation of the original clone constructor.
public
enableOriginalClone() : $this
Return values
$thisenableOriginalConstructor()
Enables the invocation of the original constructor.
public
enableOriginalConstructor() : $this
Return values
$thisenableProxyingToOriginalMethods()
Enables the invocation of the original methods.
public
enableProxyingToOriginalMethods() : $this
Tags
Return values
$thisgetMock()
Creates a mock object using a fluent interface.
public
getMock() : MockObject
Tags
Return values
MockObjectgetMockForAbstractClass()
Creates a mock object for an abstract class using a fluent interface.
public
getMockForAbstractClass() : MockObject
Tags
Return values
MockObjectgetMockForTrait()
Creates a mock object for a trait using a fluent interface.
public
getMockForTrait() : MockObject
Tags
Return values
MockObjectonlyMethods()
Specifies the subset of methods to mock, requiring each to exist in the class.
public
onlyMethods(array<string|int, mixed> $methods) : $this
Parameters
- $methods : array<string|int, mixed>
Tags
Return values
$thissetConstructorArgs()
Specifies the arguments for the constructor.
public
setConstructorArgs(array<string|int, mixed> $arguments) : $this
Parameters
- $arguments : array<string|int, mixed>
Return values
$thissetMockClassName()
Specifies the name for the mock class.
public
setMockClassName(string $name) : $this
Parameters
- $name : string
Tags
Return values
$thissetProxyTarget()
Sets the proxy target.
public
setProxyTarget(object $object) : $this
Parameters
- $object : object