Browse Source

Don't always add Form and Paginator.

They are lazy loaded as needed. We don't need to force them into the
property lists.
mark_story 12 years ago
parent
commit
19c7ab7943

+ 0 - 6
src/Console/Command/Task/ControllerTask.php

@@ -232,9 +232,6 @@ class ControllerTask extends BakeTask {
 			$components = explode(',', $this->params['components']);
 			$components = array_values(array_filter(array_map('trim', $components)));
 		}
-		if (!in_array('Paginator', $components)) {
-			$components[] = 'Paginator';
-		}
 		return $components;
 	}
 
@@ -249,9 +246,6 @@ class ControllerTask extends BakeTask {
 			$helpers = explode(',', $this->params['helpers']);
 			$helpers = array_values(array_filter(array_map('trim', $helpers)));
 		}
-		if (count($helpers) && !in_array('Form', $helpers)) {
-			$helpers[] = 'Form';
-		}
 		return $helpers;
 	}
 

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

@@ -121,15 +121,11 @@ class ControllerTaskTest extends TestCase {
  */
 	public function testGetComponents() {
 		$result = $this->Task->getComponents();
-		$this->assertSame(['Paginator'], $result);
+		$this->assertSame([], $result);
 
 		$this->Task->params['components'] = '  , Security, ,  Csrf';
 		$result = $this->Task->getComponents();
-		$this->assertSame(['Security', 'Csrf', 'Paginator'], $result);
-
-		$this->Task->params['components'] = '  Paginator , Security, ,  Csrf';
-		$result = $this->Task->getComponents();
-		$this->assertSame(['Paginator', 'Security', 'Csrf'], $result);
+		$this->assertSame(['Security', 'Csrf'], $result);
 	}
 
 /**
@@ -143,11 +139,7 @@ class ControllerTaskTest extends TestCase {
 
 		$this->Task->params['helpers'] = '  , Session , ,  Number';
 		$result = $this->Task->getHelpers();
-		$this->assertSame(['Session', 'Number', 'Form'], $result);
-
-		$this->Task->params['helpers'] = '  Session , Number , ,  Form';
-		$result = $this->Task->getHelpers();
-		$this->assertSame(['Session', 'Number', 'Form'], $result);
+		$this->assertSame(['Session', 'Number'], $result);
 	}
 
 /**
@@ -305,7 +297,7 @@ class ControllerTaskTest extends TestCase {
 			->method('createFile')
 			->with($filename, $this->logicalAnd(
 				$this->stringContains('class BakeArticlesController'),
-				$this->stringContains("\$helpers = ['Time', 'Text', 'Form']")
+				$this->stringContains("\$helpers = ['Time', 'Text']")
 			))
 			->will($this->returnValue(true));
 

+ 2 - 3
tests/bake_compare/Controller/NoActions.ctp

@@ -9,7 +9,6 @@ use App\Controller\AppController;
  * @property App\Model\Table\BakeArticlesTable $BakeArticles
  * @property CsrfComponent $Csrf
  * @property AuthComponent $Auth
- * @property PaginatorComponent $Paginator
  */
 class BakeArticlesController extends AppController {
 
@@ -18,13 +17,13 @@ class BakeArticlesController extends AppController {
  *
  * @var array
  */
-	public $helpers = ['Html', 'Time', 'Form'];
+	public $helpers = ['Html', 'Time'];
 
 /**
  * Components
  *
  * @var array
  */
-	public $components = ['Csrf', 'Auth', 'Paginator'];
+	public $components = ['Csrf', 'Auth'];
 
 }