Browse Source

Starting to move all console related classes, ViewTask tests passing

Jose Lorenzo Rodriguez 15 years ago
parent
commit
2ef02ba29b

app/console/shells/templates/empty → app/console/templates/empty


+ 2 - 2
lib/Cake/Console/Command/Task/TemplateTask.php

@@ -54,8 +54,8 @@ class TemplateTask extends Shell {
  * @return array Array of bake themes that are installed.
  */
 	protected function _findThemes() {
-		$paths = App::path('shells');
-		$core = array_pop($paths);
+		$paths = App::path('Console');
+		$core = current(App::core('Console'));
 		$separator = DS === '/' ? '/' : '\\\\';
 		$core = preg_replace('#shells' . $separator . '$#', '', $core);
 

+ 2 - 2
lib/Cake/Console/Command/Task/ViewTask.php

@@ -147,7 +147,7 @@ class ViewTask extends BakeTask {
 	protected function _methodsToBake() {
 		$methods =  array_diff(
 			array_map('strtolower', get_class_methods($this->controllerName . 'Controller')),
-			array_map('strtolower', get_class_methods('appcontroller'))
+			array_map('strtolower', get_class_methods('AppController'))
 		);
 		$scaffoldActions = false;
 		if (empty($methods)) {
@@ -277,7 +277,7 @@ class ViewTask extends BakeTask {
 		}
 
 		$controllerClassName = $this->controllerName . 'Controller';
-		App::uses($controllerName, $plugin . 'Controller');
+		App::uses($controllerClassName, $plugin . 'Controller');
 		if (!class_exists($controllerClassName)) {
 			$file = $controllerClassName . '.php';
 			$this->err(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));

+ 1 - 1
lib/Cake/Console/TaskCollection.php

@@ -60,7 +60,7 @@ class TaskCollection extends ObjectCollection {
 		}
 		$taskFile = Inflector::underscore($name);
 		$taskClass = $name . 'Task';
-		App::uses($taskClass, 'Console/Command/Task');
+		App::uses($taskClass, $plugin . 'Console/Command/Task');
 		if (!class_exists($taskClass)) {
 			if (!class_exists($taskClass)) {
 				throw new MissingTaskClassException($taskClass);

+ 10 - 2
lib/Cake/Core/App.php

@@ -302,13 +302,21 @@ class App {
 					'%s' . 'vendors' . DS . 'shells' . DS,
 					VENDORS . 'shells' . DS
 				),
+				'Console/Command' => array(
+					'%s' . 'console' . DS . 'shells' . DS,
+					'%s' . 'vendors' . DS . 'shells' . DS,
+					VENDORS . 'shells' . DS
+				),
+				'Console/Command/Task' => array(
+					'%s' . 'console' . DS . 'shells' . DS . 'tasks' . DS,
+					'%s' . 'vendors' . DS . 'shells' . DS . 'tasks' . DS,
+					VENDORS . 'shells' . DS . 'tasks' . DS
+				),
 				'libs' => array('%s' . 'libs' . DS),
 				'locales' => array('%s' . 'locale' . DS),
 				'vendors' => array('%s' . 'vendors' . DS, VENDORS),
 				'plugins' => array(APP . 'plugins' . DS)
 			);
-
-			self::$__packageFormat['Console/Command'] = self::$__packageFormat['Console'];
 		}
 
 		if ($reset == true) {

+ 1 - 1
lib/Cake/tests/cases/console/libs/task_collection.test.php

@@ -72,7 +72,7 @@ class TaskCollectionTest extends CakeTestCase {
 /**
  * test missinghelper exception
  *
- * @expectedException MissingTaskFileException
+ * @expectedException MissingTaskClassException
  * @return void
  */
 	function testLoadMissingTaskFile() {

+ 4 - 0
lib/Cake/tests/cases/console/shells/tasks/view.test.php

@@ -20,12 +20,16 @@
  */
 
 App::uses('ShellDispatcher', 'Console');
+App::uses('ConsoleOutput', 'Console');
+App::uses('ConsoleInput', 'Console');
 App::uses('Shell', 'Console');
 App::uses('ViewTask', 'Console/Command/Task');
 App::uses('ControllerTask', 'Console/Command/Task');
 App::uses('TemplateTask', 'Console/Command/Task');
 App::uses('ProjectTask', 'Console/Command/Task');
 App::uses('DbConfigTask', 'Console/Command/Task');
+App::uses('Model', 'Model');
+App::uses('Controller', 'Controller');
 
 /**
  * Test View Task Comment Model