mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
b47e445c33
commit
7c2ad08da5
1 changed files with 30 additions and 11 deletions
|
@ -741,10 +741,15 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
* @deprecated Use `getMockBuilder()` or `createMock()` in new unit tests.
|
* @deprecated Use `getMockBuilder()` or `createMock()` in new unit tests.
|
||||||
* @see https://phpunit.de/manual/current/en/test-doubles.html
|
* @see https://phpunit.de/manual/current/en/test-doubles.html
|
||||||
*/
|
*/
|
||||||
protected function _buildMock($originalClassName, $methods = array(),
|
protected function _buildMock(
|
||||||
array $arguments = array(), $mockClassName = '',
|
$originalClassName,
|
||||||
$callOriginalConstructor = true, $callOriginalClone = true,
|
$methods = array(),
|
||||||
$callAutoload = true) {
|
array $arguments = array(),
|
||||||
|
$mockClassName = '',
|
||||||
|
$callOriginalConstructor = true,
|
||||||
|
$callOriginalClone = true,
|
||||||
|
$callAutoload = true
|
||||||
|
) {
|
||||||
$MockBuilder = $this->getMockBuilder($originalClassName);
|
$MockBuilder = $this->getMockBuilder($originalClassName);
|
||||||
if (!empty($methods)) {
|
if (!empty($methods)) {
|
||||||
$MockBuilder = $MockBuilder->setMethods($methods);
|
$MockBuilder = $MockBuilder->setMethods($methods);
|
||||||
|
@ -797,11 +802,18 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
* @deprecated Use `getMockBuilder()` or `createMock()` in new unit tests.
|
* @deprecated Use `getMockBuilder()` or `createMock()` in new unit tests.
|
||||||
* @see https://phpunit.de/manual/current/en/test-doubles.html
|
* @see https://phpunit.de/manual/current/en/test-doubles.html
|
||||||
*/
|
*/
|
||||||
public function getMock($originalClassName, $methods = array(),
|
public function getMock(
|
||||||
array $arguments = array(), $mockClassName = '',
|
$originalClassName,
|
||||||
$callOriginalConstructor = true, $callOriginalClone = true,
|
$methods = array(),
|
||||||
$callAutoload = true, $cloneArguments = false,
|
array $arguments = array(),
|
||||||
$callOriginalMethods = false, $proxyTarget = null) {
|
$mockClassName = '',
|
||||||
|
$callOriginalConstructor = true,
|
||||||
|
$callOriginalClone = true,
|
||||||
|
$callAutoload = true,
|
||||||
|
$cloneArguments = false,
|
||||||
|
$callOriginalMethods = false,
|
||||||
|
$proxyTarget = null
|
||||||
|
) {
|
||||||
$phpUnitVersion = PHPUnit_Runner_Version::id();
|
$phpUnitVersion = PHPUnit_Runner_Version::id();
|
||||||
if (version_compare($phpUnitVersion, '5.7.0', '<')) {
|
if (version_compare($phpUnitVersion, '5.7.0', '<')) {
|
||||||
return parent::getMock($originalClassName, $methods, $arguments,
|
return parent::getMock($originalClassName, $methods, $arguments,
|
||||||
|
@ -817,8 +829,15 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
if ($proxyTarget !== null) {
|
if ($proxyTarget !== null) {
|
||||||
throw new InvalidArgumentException('$proxyTarget parameter is not supported');
|
throw new InvalidArgumentException('$proxyTarget parameter is not supported');
|
||||||
}
|
}
|
||||||
return $this->_buildMock($originalClassName, $methods, $arguments,
|
return $this->_buildMock(
|
||||||
$mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload);
|
$originalClassName,
|
||||||
|
$methods,
|
||||||
|
$arguments,
|
||||||
|
$mockClassName,
|
||||||
|
$callOriginalConstructor,
|
||||||
|
$callOriginalClone,
|
||||||
|
$callAutoload
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue