Class MockBuilder
PHPUnit MockBuilder with muted Reflection errors
Method Summary
-
__construct() public
-
allowMockingUnknownTypes() public
-
disableArgumentCloning() public
Disables the cloning of arguments passed to mocked methods.
-
disableAutoload() public
Disables the use of class autoloading while creating the mock object.
-
disableOriginalClone() public
Disables the invocation of the original clone constructor.
-
disableOriginalConstructor() public
Disables the invocation of the original constructor.
-
disableProxyingToOriginalMethods() public
Disables the invocation of the original methods.
-
disallowMockingUnknownTypes() public
-
enableArgumentCloning() public
Enables the cloning of arguments passed to mocked methods.
-
enableAutoload() public
Enables the use of class autoloading while creating the mock object.
-
enableOriginalClone() public
Enables the invocation of the original clone constructor.
-
enableOriginalConstructor() public
Enables the invocation of the original constructor.
-
enableProxyingToOriginalMethods() public
Enables the invocation of the original methods.
-
getMock() public
Creates a mock object using a fluent interface.
-
getMockForAbstractClass() public
Creates a mock object for an abstract class using a fluent interface.
-
getMockForTrait() public
Creates a mock object for a trait using a fluent interface.
-
setConstructorArgs() public
Specifies the arguments for the constructor.
-
setMethods() public
Specifies the subset of methods to mock. Default is to mock none of them.
-
setMethodsExcept() public
Specifies the subset of methods to not mock. Default is to mock all of them.
-
setMockClassName() public
Specifies the name for the mock class.
-
setProxyTarget() public
Sets the proxy target.
-
setSupressedErrorHandler() public static
Set error handler to supress
ReflectionType::__toString()
deprecation warning
Method Detail
__construct() ¶ public
__construct(TestCase $testCase, array|string $type)
Parameters
-
TestCase
$testCase -
array|string
$type
disableArgumentCloning() ¶ public
disableArgumentCloning(): MockBuilder
Disables the cloning of arguments passed to mocked methods.
Returns
MockBuilder
disableAutoload() ¶ public
disableAutoload(): MockBuilder
Disables the use of class autoloading while creating the mock object.
Returns
MockBuilder
disableOriginalClone() ¶ public
disableOriginalClone(): MockBuilder
Disables the invocation of the original clone constructor.
Returns
MockBuilder
disableOriginalConstructor() ¶ public
disableOriginalConstructor(): MockBuilder
Disables the invocation of the original constructor.
Returns
MockBuilder
disableProxyingToOriginalMethods() ¶ public
disableProxyingToOriginalMethods(): MockBuilder
Disables the invocation of the original methods.
Returns
MockBuilder
disallowMockingUnknownTypes() ¶ public
disallowMockingUnknownTypes(): MockBuilder
Returns
MockBuilder
enableArgumentCloning() ¶ public
enableArgumentCloning(): MockBuilder
Enables the cloning of arguments passed to mocked methods.
Returns
MockBuilder
enableAutoload() ¶ public
enableAutoload(): MockBuilder
Enables the use of class autoloading while creating the mock object.
Returns
MockBuilder
enableOriginalClone() ¶ public
enableOriginalClone(): MockBuilder
Enables the invocation of the original clone constructor.
Returns
MockBuilder
enableOriginalConstructor() ¶ public
enableOriginalConstructor(): MockBuilder
Enables the invocation of the original constructor.
Returns
MockBuilder
enableProxyingToOriginalMethods() ¶ public
enableProxyingToOriginalMethods(): MockBuilder
Enables the invocation of the original methods.
Returns
MockBuilder
getMock() ¶ public
getMock(): MockObject
Creates a mock object using a fluent interface.
Returns
MockObject
getMockForAbstractClass() ¶ public
getMockForAbstractClass(): MockObject
Creates a mock object for an abstract class using a fluent interface.
Returns
MockObject
getMockForTrait() ¶ public
getMockForTrait(): MockObject
Creates a mock object for a trait using a fluent interface.
Returns
MockObject
setConstructorArgs() ¶ public
setConstructorArgs(array $args): MockBuilder
Specifies the arguments for the constructor.
Parameters
-
array
$args
Returns
MockBuilder
setMethods() ¶ public
setMethods(array|null $methods = null): MockBuilder
Specifies the subset of methods to mock. Default is to mock none of them.
Parameters
-
array|null
$methods optional
Returns
MockBuilder
setMethodsExcept() ¶ public
setMethodsExcept(array $methods = []): MockBuilder
Specifies the subset of methods to not mock. Default is to mock all of them.
Parameters
-
array
$methods optional
Returns
MockBuilder
setMockClassName() ¶ public
setMockClassName(string $name): MockBuilder
Specifies the name for the mock class.
Parameters
-
string
$name
Returns
MockBuilder
setProxyTarget() ¶ public
setProxyTarget(object $object): MockBuilder
Sets the proxy target.
Parameters
-
object
$object
Returns
MockBuilder
setSupressedErrorHandler() ¶ public static
setSupressedErrorHandler(): void
Set error handler to supress ReflectionType::__toString()
deprecation warning
Returns
void