From 5953171c7bd14205814bc34b1d12398f4b68ca05 Mon Sep 17 00:00:00 2001 From: Phally Date: Sat, 20 Jul 2013 20:21:35 +0200 Subject: [PATCH] Fixes cake bake all. Refs #1443. --- lib/Cake/Console/Command/Task/ControllerTask.php | 5 +++++ .../Test/Case/Console/Command/Task/ControllerTaskTest.php | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php index cb1a7685779..bea789f25a4 100644 --- a/lib/Cake/Console/Command/Task/ControllerTask.php +++ b/lib/Cake/Console/Command/Task/ControllerTask.php @@ -328,6 +328,11 @@ public function bake($controllerName, $actions = '', $helpers = null, $component 'plugin' => $this->plugin, 'pluginPath' => empty($this->plugin) ? '' : $this->plugin . '.' )); + + if (!in_array('Paginator', (array)$components)) { + $components[] = 'Paginator'; + } + $this->Template->set(compact('controllerName', 'actions', 'helpers', 'components', 'isScaffold')); $contents = $this->Template->generate('classes', 'controller'); diff --git a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php index 2047314d68f..fcf86204b6d 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php @@ -286,8 +286,9 @@ public function testBake() { $this->assertContains(' * @property Article $Article', $result); $this->assertContains(' * @property AclComponent $Acl', $result); $this->assertContains(' * @property AuthComponent $Auth', $result); + $this->assertContains(' * @property PaginatorComponent $Paginator', $result); $this->assertContains('class ArticlesController extends AppController', $result); - $this->assertContains("public \$components = array('Acl', 'Auth')", $result); + $this->assertContains("public \$components = array('Acl', 'Auth', 'Paginator')", $result); $this->assertContains("public \$helpers = array('Js', 'Time')", $result); $this->assertContains("--actions--", $result); @@ -300,8 +301,8 @@ public function testBake() { $result = $this->Task->bake('Articles', '--actions--', array(), array()); $this->assertContains('class ArticlesController extends AppController', $result); - $this->assertSame(substr_count($result, '@property'), 1); - $this->assertNotContains('components', $result); + $this->assertSame(substr_count($result, '@property'), 2); + $this->assertContains("public \$components = array('Paginator')", $result); $this->assertNotContains('helpers', $result); $this->assertContains('--actions--', $result); }