class PHPUnit_Framework_MockObject_MockBuilder (View source)

Implementation of the Builder pattern for Mock objects.

Methods

__construct(TestCase $testCase, array|string $type)

No description

getMock()

Creates a mock object using a fluent interface.

getMockForAbstractClass()

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

getMockForTrait()

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

setMethods(array $methods = null)

Specifies the subset of methods to mock. Default is to mock all of them.

setMethodsExcept(array $methods = [])

Specifies the subset of methods to not mock. Default is to mock all of them.

setConstructorArgs(array $args)

Specifies the arguments for the constructor.

setMockClassName(string $name)

Specifies the name for the mock class.

disableOriginalConstructor()

Disables the invocation of the original constructor.

enableOriginalConstructor()

Enables the invocation of the original constructor.

disableOriginalClone()

Disables the invocation of the original clone constructor.

enableOriginalClone()

Enables the invocation of the original clone constructor.

disableAutoload()

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

enableAutoload()

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

disableArgumentCloning()

Disables the cloning of arguments passed to mocked methods.

enableArgumentCloning()

Enables the cloning of arguments passed to mocked methods.

enableProxyingToOriginalMethods()

Enables the invocation of the original methods.

disableProxyingToOriginalMethods()

Disables the invocation of the original methods.

setProxyTarget(object $object)

Sets the proxy target.

Details

__construct(TestCase $testCase, array|string $type)

Parameters

TestCase $testCase
array|string $type

PHPUnit_Framework_MockObject_MockObject getMock()

Creates a mock object using a fluent interface.

PHPUnit_Framework_MockObject_MockObject getMockForAbstractClass()

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

PHPUnit_Framework_MockObject_MockObject getMockForTrait()

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

PHPUnit_Framework_MockObject_MockBuilder setMethods(array $methods = null)

Specifies the subset of methods to mock. Default is to mock all of them.

Parameters

array $methods

Return Value

PHPUnit_Framework_MockObject_MockBuilder

PHPUnit_Framework_MockObject_MockBuilder setMethodsExcept(array $methods = [])

Specifies the subset of methods to not mock. Default is to mock all of them.

Parameters

array $methods

Return Value

PHPUnit_Framework_MockObject_MockBuilder

PHPUnit_Framework_MockObject_MockBuilder setConstructorArgs(array $args)

Specifies the arguments for the constructor.

Parameters

array $args

Return Value

PHPUnit_Framework_MockObject_MockBuilder

PHPUnit_Framework_MockObject_MockBuilder setMockClassName(string $name)

Specifies the name for the mock class.

Parameters

string $name

Return Value

PHPUnit_Framework_MockObject_MockBuilder

PHPUnit_Framework_MockObject_MockBuilder disableOriginalConstructor()

Disables the invocation of the original constructor.

PHPUnit_Framework_MockObject_MockBuilder enableOriginalConstructor()

Enables the invocation of the original constructor.

PHPUnit_Framework_MockObject_MockBuilder disableOriginalClone()

Disables the invocation of the original clone constructor.

PHPUnit_Framework_MockObject_MockBuilder enableOriginalClone()

Enables the invocation of the original clone constructor.

PHPUnit_Framework_MockObject_MockBuilder disableAutoload()

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

PHPUnit_Framework_MockObject_MockBuilder enableAutoload()

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

PHPUnit_Framework_MockObject_MockBuilder disableArgumentCloning()

Disables the cloning of arguments passed to mocked methods.

PHPUnit_Framework_MockObject_MockBuilder enableArgumentCloning()

Enables the cloning of arguments passed to mocked methods.

PHPUnit_Framework_MockObject_MockBuilder enableProxyingToOriginalMethods()

Enables the invocation of the original methods.

PHPUnit_Framework_MockObject_MockBuilder disableProxyingToOriginalMethods()

Disables the invocation of the original methods.

PHPUnit_Framework_MockObject_MockBuilder setProxyTarget(object $object)

Sets the proxy target.

Parameters

object $object

Return Value

PHPUnit_Framework_MockObject_MockBuilder