Making getMockForModel actually useful

This commit is contained in:
Jose Lorenzo Rodriguez 2012-12-23 00:30:27 +01:00
parent bcda684ad7
commit f25f35353d

View file

@ -691,11 +691,13 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
$config = ClassRegistry::config('Model'); $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)); $config = array_merge((array)$config, array('name' => $name));
$mock = $this->getMock($name, $methods, array($config)); $mock = $this->getMock($name, $methods, array($config));
ClassRegistry::removeObject($name); ClassRegistry::removeObject($name);
ClassRegistry::addObject($name, $mock); ClassRegistry::addObject($name, $mock);
return $mock; return $mock;
} }
} }