Fixing missing imports in generated tests.

Fixes #3059
This commit is contained in:
mark_story 2012-07-23 21:25:55 -04:00
parent e6ef218600
commit 35bf3097cd
2 changed files with 3 additions and 0 deletions

View file

@ -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');

View file

@ -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);