mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Making getMockForModel actually useful
This commit is contained in:
parent
bcda684ad7
commit
f25f35353d
1 changed files with 3 additions and 1 deletions
|
@ -691,11 +691,13 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
$config = ClassRegistry::config('Model');
|
||||
}
|
||||
|
||||
list($plugin, $name) = pluginSplit($model);
|
||||
list($plugin, $name) = pluginSplit($model, true);
|
||||
App::uses($name, $plugin . 'Model');
|
||||
$config = array_merge((array)$config, array('name' => $name));
|
||||
$mock = $this->getMock($name, $methods, array($config));
|
||||
ClassRegistry::removeObject($name);
|
||||
ClassRegistry::addObject($name, $mock);
|
||||
return $mock;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue