Skip to content

Commit

Permalink
Fixed indefinite loop in getMock().
Browse files Browse the repository at this point in the history
  • Loading branch information
bancer committed Jul 15, 2017
1 parent eefd3ac commit 93696b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Cake/TestSuite/CakeTestCase.php
Expand Up @@ -737,6 +737,9 @@ protected function skipUnless($condition, $message = '') {
* to disable the call to the original class' clone constructor.
* @param boolean $callAutoload The seventh (optional) parameter can be used to
* disable __autoload() during the generation of the test double class.
* @param boolean $cloneArguments Not supported.
* @param boolean $callOriginalMethods Not supported.
* @param string $proxyTarget Not supported.
* @return object
* @throws InvalidArgumentException
* @deprecated Use `getMockBuilder()` or `createMock` in new unit tests.
Expand All @@ -747,6 +750,12 @@ public function getMock($originalClassName, $methods = array(),
$callOriginalConstructor = true, $callOriginalClone = true,
$callAutoload = true, $cloneArguments = false,
$callOriginalMethods = false, $proxyTarget = null) {
$phpUnitVersion = PHPUnit_Runner_Version::id();
if ($phpUnitVersion < '5.7.0') {
return parent::getMock($originalClassName, $methods, $arguments,
$mockClassName, $callOriginalConstructor, $callOriginalClone,
$callAutoload, $cloneArguments, $callOriginalMethods, $proxyTarget);
}
$MockBuilder = $this->getMockBuilder($originalClassName);
if (!empty($methods)) {
$MockBuilder = $MockBuilder->setMethods($methods);
Expand Down

0 comments on commit 93696b6

Please sign in to comment.