Class MockBuilder

PHPUnit MockBuilder with muted Reflection errors

Namespace: Cake\TestSuite

Method Summary

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\MockBuilder

disableArgumentCloning() public

disableArgumentCloning()

Disables the cloning of arguments passed to mocked methods.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

disableAutoload() public

disableAutoload()

Disables the use of class autoloading while creating the mock object.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

disableOriginalClone() public

disableOriginalClone()

Disables the invocation of the original clone constructor.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

disableOriginalConstructor() public

disableOriginalConstructor()

Disables the invocation of the original constructor.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

disableProxyingToOriginalMethods() public

disableProxyingToOriginalMethods()

Disables the invocation of the original methods.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

disallowMockingUnknownTypes() public

disallowMockingUnknownTypes()

Returns

\PHPUnit\Framework\MockObject\MockBuilder

enableArgumentCloning() public

enableArgumentCloning()

Enables the cloning of arguments passed to mocked methods.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

enableAutoload() public

enableAutoload()

Enables the use of class autoloading while creating the mock object.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

enableOriginalClone() public

enableOriginalClone()

Enables the invocation of the original clone constructor.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

enableOriginalConstructor() public

enableOriginalConstructor()

Enables the invocation of the original constructor.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

enableProxyingToOriginalMethods() public

enableProxyingToOriginalMethods()

Enables the invocation of the original methods.

Returns

\PHPUnit\Framework\MockObject\MockBuilder

getMock() public

getMock()

Creates a mock object using a fluent interface.

Returns

\PHPUnit\Framework\MockObject\MockObject

getMockForAbstractClass() public

getMockForAbstractClass()

Creates a mock object for an abstract class using a fluent interface.

Returns

\PHPUnit\Framework\MockObject\MockObject

getMockForTrait() public

getMockForTrait()

Creates a mock object for a trait using a fluent interface.

Returns

\PHPUnit\Framework\MockObject\MockObject

setConstructorArgs() public

setConstructorArgs(array $args)

Specifies the arguments for the constructor.

Parameters

array $args

Returns

\PHPUnit\Framework\MockObject\MockBuilder

setMethods() 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\MockBuilder

setMethodsExcept() 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\MockBuilder

setMockClassName() public

setMockClassName(mixed $name)

Specifies the name for the mock class.

Parameters

string $name

Returns

\PHPUnit\Framework\MockObject\MockBuilder

setProxyTarget() public

setProxyTarget(mixed $object)

Sets the proxy target.

Parameters

object $object

Returns

\PHPUnit\Framework\MockObject\MockBuilder

setSupressedErrorHandler() 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