Class MockBuilder
PHPUnit MockBuilder with muted Reflection errors
Method Summary
- __construct() public
- allowMockingUnknownTypes() public
- getMockForAbstractClass() public
Creates a mock object for an abstract class using a fluent interface.
- setMethodsExcept() public
Specifies the subset of methods to not mock. Default is to mock all of them.
- setSupressedErrorHandler() public static
Set error handler to supress
ReflectionType::__toString()deprecation warning
Method Detail
__construct() public
__construct(\PHPUnit\Framework\TestCase $testCase, mixed $type)
Parameters
-
\PHPUnit\Framework\TestCase$testCase -
array|string$type
allowMockingUnknownTypes() public
allowMockingUnknownTypes()
Returns
\PHPUnit\Framework\MockObject\MockBuilderdisableArgumentCloning() public
disableArgumentCloning()
Disables the cloning of arguments passed to mocked methods.
Returns
\PHPUnit\Framework\MockObject\MockBuilderdisableAutoload() public
disableAutoload()
Disables the use of class autoloading while creating the mock object.
Returns
\PHPUnit\Framework\MockObject\MockBuilderdisableOriginalClone() public
disableOriginalClone()
Disables the invocation of the original clone constructor.
Returns
\PHPUnit\Framework\MockObject\MockBuilderdisableOriginalConstructor() public
disableOriginalConstructor()
Disables the invocation of the original constructor.
Returns
\PHPUnit\Framework\MockObject\MockBuilderdisableProxyingToOriginalMethods() public
disableProxyingToOriginalMethods()
Disables the invocation of the original methods.
Returns
\PHPUnit\Framework\MockObject\MockBuilderdisallowMockingUnknownTypes() public
disallowMockingUnknownTypes()
Returns
\PHPUnit\Framework\MockObject\MockBuilderenableArgumentCloning() public
enableArgumentCloning()
Enables the cloning of arguments passed to mocked methods.
Returns
\PHPUnit\Framework\MockObject\MockBuilderenableAutoload() public
enableAutoload()
Enables the use of class autoloading while creating the mock object.
Returns
\PHPUnit\Framework\MockObject\MockBuilderenableOriginalClone() public
enableOriginalClone()
Enables the invocation of the original clone constructor.
Returns
\PHPUnit\Framework\MockObject\MockBuilderenableOriginalConstructor() public
enableOriginalConstructor()
Enables the invocation of the original constructor.
Returns
\PHPUnit\Framework\MockObject\MockBuilderenableProxyingToOriginalMethods() public
enableProxyingToOriginalMethods()
Enables the invocation of the original methods.
Returns
\PHPUnit\Framework\MockObject\MockBuildergetMock() public
getMock()
Creates a mock object using a fluent interface.
Returns
\PHPUnit\Framework\MockObject\MockObjectgetMockForAbstractClass() public
getMockForAbstractClass()
Creates a mock object for an abstract class using a fluent interface.
Returns
\PHPUnit\Framework\MockObject\MockObjectgetMockForTrait() public
getMockForTrait()
Creates a mock object for a trait using a fluent interface.
Returns
\PHPUnit\Framework\MockObject\MockObjectsetConstructorArgs() public
setConstructorArgs(array $args)
Specifies the arguments for the constructor.
Parameters
-
array$args
Returns
\PHPUnit\Framework\MockObject\MockBuildersetMethods() public
setMethods(array $methods)
Specifies the subset of methods to mock. Default is to mock none of them.
Parameters
-
array|null$methods optional
Returns
\PHPUnit\Framework\MockObject\MockBuildersetMethodsExcept() public
setMethodsExcept(array $methods)
Specifies the subset of methods to not mock. Default is to mock all of them.
Parameters
-
array$methods optional
Returns
\PHPUnit\Framework\MockObject\MockBuildersetMockClassName() public
setMockClassName(mixed $name)
Specifies the name for the mock class.
Parameters
-
string$name
Returns
\PHPUnit\Framework\MockObject\MockBuildersetProxyTarget() public
setProxyTarget(mixed $object)
Sets the proxy target.
Parameters
-
object$object
Returns
\PHPUnit\Framework\MockObject\MockBuildersetSupressedErrorHandler() public static
setSupressedErrorHandler()
Set error handler to supress ReflectionType::__toString() deprecation warning
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.9/class-Cake.TestSuite.MockBuilder.html