From 35bf3097cd3c22eedb9c9588e5caa3bee0866da8 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 23 Jul 2012 21:25:55 -0400 Subject: [PATCH] Fixing missing imports in generated tests. Fixes #3059 --- lib/Cake/Console/Command/Task/TestTask.php | 1 + lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/Cake/Console/Command/Task/TestTask.php b/lib/Cake/Console/Command/Task/TestTask.php index b5b6c501b..b49296ee1 100644 --- a/lib/Cake/Console/Command/Task/TestTask.php +++ b/lib/Cake/Console/Command/Task/TestTask.php @@ -479,6 +479,7 @@ class TestTask extends BakeTask { */ public function generateUses($type, $realType, $className) { $uses = array(); + $type = strtolower($type); if ($type == 'component') { $uses[] = array('ComponentCollection', 'Controller'); $uses[] = array('Component', 'Controller'); diff --git a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php index 6806af826..7eb5fa8b4 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php @@ -491,6 +491,8 @@ class TestTaskTest extends CakeTestCase { $result = $this->Task->bake('Component', 'Example'); + $this->assertContains("App::uses('Component', 'Controller')", $result); + $this->assertContains("App::uses('ComponentCollection', 'Controller')", $result); $this->assertContains("App::uses('ExampleComponent', 'Controller/Component')", $result); $this->assertContains('class ExampleComponentTest extends CakeTestCase', $result);