Browse Source

Fix test generation for prefixed controllers.

mark_story 12 years ago
parent
commit
ac0692b23b

+ 3 - 1
src/Console/Command/Task/ControllerTask.php

@@ -217,7 +217,9 @@ class ControllerTask extends BakeTask {
 		}
 		$this->Test->plugin = $this->plugin;
 		$this->Test->connection = $this->connection;
-		$this->Test->interactive = $this->interactive;
+		if (!empty($this->params['prefix'])) {
+			$className = $this->params['prefix'] . '\\' . $className;
+		}
 		return $this->Test->bake('Controller', $className);
 	}
 

+ 4 - 0
tests/TestCase/Console/Command/Task/ControllerTaskTest.php

@@ -193,6 +193,10 @@ class ControllerTaskTest extends TestCase {
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with($filename, $this->anything());
+
+		$this->Task->Test->expects($this->at(0))
+			->method('bake')
+			->with('Controller', 'Admin\BakeArticles');
 		$result = $this->Task->bake('BakeArticles');
 
 		$this->assertTextContains('namespace App\Controller\Admin;', $result);