Skip to content

Commit 35bf309

Browse files
committed
Fixing missing imports in generated tests.
Fixes #3059
1 parent e6ef218 commit 35bf309

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/Cake/Console/Command/Task/TestTask.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ public function generateConstructor($type, $fullClassName, $plugin) {
479479
*/
480480
public function generateUses($type, $realType, $className) {
481481
$uses = array();
482+
$type = strtolower($type);
482483
if ($type == 'component') {
483484
$uses[] = array('ComponentCollection', 'Controller');
484485
$uses[] = array('Component', 'Controller');

lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ public function testBakeComponentTest() {
491491

492492
$result = $this->Task->bake('Component', 'Example');
493493

494+
$this->assertContains("App::uses('Component', 'Controller')", $result);
495+
$this->assertContains("App::uses('ComponentCollection', 'Controller')", $result);
494496
$this->assertContains("App::uses('ExampleComponent', 'Controller/Component')", $result);
495497
$this->assertContains('class ExampleComponentTest extends CakeTestCase', $result);
496498

0 commit comments

Comments
 (0)