These registry clear calls were useful when TestTask and ModelTask could be executed multiple times interactively. However, that is not possible now so they are a liability that causes `bake all` to act inconsistently. Refs #3997
@@ -631,7 +631,6 @@ class ModelTask extends BakeTask {
$filename = $path . 'Table' . DS . $name . 'Table.php';
$this->out("\n" . __d('cake_console', 'Baking table class for %s...', $name), 1, Shell::QUIET);
$this->createFile($filename, $out);
- TableRegistry::clear();
return $out;
}
@@ -236,7 +236,6 @@ class TestTask extends BakeTask {
* @return object And instance of the class that is going to be tested.
*/
public function buildTestSubject($type, $class) {
if (strtolower($type) === 'table') {
list($namespace, $name) = namespaceSplit($class);
$name = str_replace('Table', '', $name);
@@ -233,18 +233,6 @@ class TestTaskTest extends TestCase {
/**
- * creating test subjects should clear the registry so the registry is always fresh
- *
- * @return void
- */
- public function testRegistryClearWhenBuildingTestObjects() {
- $articles = TableRegistry::get('Articles');
- $this->Task->buildTestSubject('Table', 'Posts');
-
- $this->assertFalse(TableRegistry::exists('Articles'));
- }
-/**
* Dataprovider for class name generation.
*
* @return array