Skip to content

Commit

Permalink
Making getMockForModel actually useful
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Dec 22, 2012
1 parent bcda684 commit f25f353
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Cake/TestSuite/CakeTestCase.php
Expand Up @@ -691,11 +691,13 @@ public function getMockForModel($model, $methods = array(), $config = null) {
$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;
}

}

0 comments on commit f25f353

Please sign in to comment.