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
MockBuilderdisableAutoload() ¶ public
disableAutoload(): MockBuilder
Disables the use of class autoloading while creating the mock object.
Returns
MockBuilderdisableOriginalClone() ¶ public
disableOriginalClone(): MockBuilder
Disables the invocation of the original clone constructor.
Returns
MockBuilderdisableOriginalConstructor() ¶ public
disableOriginalConstructor(): MockBuilder
Disables the invocation of the original constructor.
Returns
MockBuilderdisableProxyingToOriginalMethods() ¶ public
disableProxyingToOriginalMethods(): MockBuilder
Disables the invocation of the original methods.
Returns
MockBuilderdisallowMockingUnknownTypes() ¶ public
disallowMockingUnknownTypes(): MockBuilder
Returns
MockBuilderenableArgumentCloning() ¶ public
enableArgumentCloning(): MockBuilder
Enables the cloning of arguments passed to mocked methods.
Returns
MockBuilderenableAutoload() ¶ public
enableAutoload(): MockBuilder
Enables the use of class autoloading while creating the mock object.
Returns
MockBuilderenableOriginalClone() ¶ public
enableOriginalClone(): MockBuilder
Enables the invocation of the original clone constructor.
Returns
MockBuilderenableOriginalConstructor() ¶ public
enableOriginalConstructor(): MockBuilder
Enables the invocation of the original constructor.
Returns
MockBuilderenableProxyingToOriginalMethods() ¶ public
enableProxyingToOriginalMethods(): MockBuilder
Enables the invocation of the original methods.
Returns
MockBuildergetMock() ¶ public
getMock(): MockObject
Creates a mock object using a fluent interface.
Returns
MockObjectgetMockForAbstractClass() ¶ public
getMockForAbstractClass(): MockObject
Creates a mock object for an abstract class using a fluent interface.
Returns
MockObjectgetMockForTrait() ¶ public
getMockForTrait(): MockObject
Creates a mock object for a trait using a fluent interface.
Returns
MockObjectsetConstructorArgs() ¶ public
setConstructorArgs(array $args): MockBuilder
Specifies the arguments for the constructor.
Parameters
-
array$args
Returns
MockBuildersetMethods() ¶ 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
MockBuildersetMethodsExcept() ¶ 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
MockBuildersetMockClassName() ¶ public
setMockClassName(string $name): MockBuilder
Specifies the name for the mock class.
Parameters
-
string$name
Returns
MockBuildersetProxyTarget() ¶ public
setProxyTarget(object $object): MockBuilder
Sets the proxy target.
Parameters
-
object$object
Returns
MockBuildersetSupressedErrorHandler() ¶ public static
setSupressedErrorHandler(): void
Set error handler to supress ReflectionType::__toString() deprecation warning
Returns
void