Permalink
Browse files

Making getMockForModel actually useful

  • Loading branch information...
1 parent bcda684 commit f25f35353d9e9d676692f6db458ed334c72d21b3 @lorenzo lorenzo committed Dec 22, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Cake/TestSuite/CakeTestCase.php
@@ -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.