PHPUnit_Framework_TestCase::getMock
Returns a mock object for the specified class.
Signature
public function getMock(string
$originalClassName,
[array|null
$methods = '',
[array
$arguments = '',
[string
$mockClassName = '',
[boolean
$callOriginalConstructor = true,
[boolean
$callOriginalClone = true,
[boolean
$callAutoload = true,
[boolean
$cloneArguments = false,
[boolean
$callOriginalMethods = false]]]]]]]] )
Parameters
$originalClassName
— string- Name of the class to mock.
$methods
— array- When provided, only methods whose names are in the array
are replaced with a configurable test double. The behavior
of the other methods is not changed.
Providing null means that no methods will be replaced. $arguments
— array- Parameters to pass to the original class' constructor.
$mockClassName
— string- Class name for the generated test double class.
$callOriginalConstructor
— boolean- Can be used to disable the call to the original class' constructor.
$callOriginalClone
— boolean- Can be used to disable the call to the original class' clone constructor.
$callAutoload
— boolean- Can be used to disable __autoload() during the generation of the test double class.
$cloneArguments
— boolean$callOriginalMethods
— boolean
Returns
- PHPUnit_Framework_MockObject_MockObject
Errors/Exceptions
Violations
Checkstyle
Line | Column | Severity | Message |
---|---|---|---|
1262 | 254 | warning | Line exceeds 120 characters; contains 253 characters |