file-fetcher
Public Member Functions | List of all members
PHPUnit\Framework\MockObject\MockBuilder Class Reference

Detailed Description

@psalm-template MockedType

Public Member Functions

 __construct (TestCase $testCase, $type)
 
 getMock ()
 
 getMockForAbstractClass ()
 
 getMockForTrait ()
 
 setMethods (?array $methods=null)
 
 onlyMethods (array $methods)
 
 addMethods (array $methods)
 
 setMethodsExcept (array $methods=[])
 
 setConstructorArgs (array $args)
 
 setMockClassName (string $name)
 
 disableOriginalConstructor ()
 
 enableOriginalConstructor ()
 
 disableOriginalClone ()
 
 enableOriginalClone ()
 
 disableAutoload ()
 
 enableAutoload ()
 
 disableArgumentCloning ()
 
 enableArgumentCloning ()
 
 enableProxyingToOriginalMethods ()
 
 disableProxyingToOriginalMethods ()
 
 setProxyTarget (object $object)
 
 allowMockingUnknownTypes ()
 
 disallowMockingUnknownTypes ()
 
 enableAutoReturnValueGeneration ()
 
 disableAutoReturnValueGeneration ()
 

Constructor & Destructor Documentation

◆ __construct()

PHPUnit\Framework\MockObject\MockBuilder::__construct ( TestCase  $testCase,
  $type 
)
Parameters
string | string[]$type@psalm-param class-string<MockedType>|string|string[] $type

Member Function Documentation

◆ addMethods()

PHPUnit\Framework\MockObject\MockBuilder::addMethods ( array  $methods)

Specifies methods that don't exist in the class which you want to mock

Parameters
string[]$methods
Exceptions
RuntimeException
Returns
$this

◆ allowMockingUnknownTypes()

PHPUnit\Framework\MockObject\MockBuilder::allowMockingUnknownTypes ( )
Returns
$this

◆ disableArgumentCloning()

PHPUnit\Framework\MockObject\MockBuilder::disableArgumentCloning ( )

Disables the cloning of arguments passed to mocked methods.

Returns
$this

◆ disableAutoload()

PHPUnit\Framework\MockObject\MockBuilder::disableAutoload ( )

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

Returns
$this

◆ disableAutoReturnValueGeneration()

PHPUnit\Framework\MockObject\MockBuilder::disableAutoReturnValueGeneration ( )
Returns
$this

◆ disableOriginalClone()

PHPUnit\Framework\MockObject\MockBuilder::disableOriginalClone ( )

Disables the invocation of the original clone constructor.

Returns
$this

◆ disableOriginalConstructor()

PHPUnit\Framework\MockObject\MockBuilder::disableOriginalConstructor ( )

Disables the invocation of the original constructor.

Returns
$this

◆ disableProxyingToOriginalMethods()

PHPUnit\Framework\MockObject\MockBuilder::disableProxyingToOriginalMethods ( )

Disables the invocation of the original methods.

Returns
$this

◆ disallowMockingUnknownTypes()

PHPUnit\Framework\MockObject\MockBuilder::disallowMockingUnknownTypes ( )
Returns
$this

◆ enableArgumentCloning()

PHPUnit\Framework\MockObject\MockBuilder::enableArgumentCloning ( )

Enables the cloning of arguments passed to mocked methods.

Returns
$this

◆ enableAutoload()

PHPUnit\Framework\MockObject\MockBuilder::enableAutoload ( )

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

Returns
$this

◆ enableAutoReturnValueGeneration()

PHPUnit\Framework\MockObject\MockBuilder::enableAutoReturnValueGeneration ( )
Returns
$this

◆ enableOriginalClone()

PHPUnit\Framework\MockObject\MockBuilder::enableOriginalClone ( )

Enables the invocation of the original clone constructor.

Returns
$this

◆ enableOriginalConstructor()

PHPUnit\Framework\MockObject\MockBuilder::enableOriginalConstructor ( )

Enables the invocation of the original constructor.

Returns
$this

◆ enableProxyingToOriginalMethods()

PHPUnit\Framework\MockObject\MockBuilder::enableProxyingToOriginalMethods ( )

Enables the invocation of the original methods.

Returns
$this

◆ getMock()

PHPUnit\Framework\MockObject\MockBuilder::getMock ( )

Creates a mock object using a fluent interface.

Exceptions
RuntimeException@psalm-return MockObject&MockedType

◆ getMockForAbstractClass()

PHPUnit\Framework\MockObject\MockBuilder::getMockForAbstractClass ( )

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

Exceptions

◆ getMockForTrait()

PHPUnit\Framework\MockObject\MockBuilder::getMockForTrait ( )

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

Exceptions

◆ onlyMethods()

PHPUnit\Framework\MockObject\MockBuilder::onlyMethods ( array  $methods)

Specifies the subset of methods to mock, requiring each to exist in the class

Parameters
string[]$methods
Exceptions
RuntimeException
Returns
$this

◆ setConstructorArgs()

PHPUnit\Framework\MockObject\MockBuilder::setConstructorArgs ( array  $args)

Specifies the arguments for the constructor.

Returns
$this

◆ setMethods()

PHPUnit\Framework\MockObject\MockBuilder::setMethods ( ?array  $methods = null)

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

Deprecated:
https://github.com/sebastianbergmann/phpunit/pull/3687
Returns
$this

◆ setMethodsExcept()

PHPUnit\Framework\MockObject\MockBuilder::setMethodsExcept ( array  $methods = [])

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

◆ setMockClassName()

PHPUnit\Framework\MockObject\MockBuilder::setMockClassName ( string  $name)

Specifies the name for the mock class.

Returns
$this

◆ setProxyTarget()

PHPUnit\Framework\MockObject\MockBuilder::setProxyTarget ( object  $object)

Sets the proxy target.

Returns
$this

The documentation for this class was generated from the following file: