Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes cake bake all. Refs #1443.
  • Loading branch information
Phally committed Jul 20, 2013
1 parent 6d6be87 commit 5953171
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/Cake/Console/Command/Task/ControllerTask.php
Expand Up @@ -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');

Expand Down
Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down

0 comments on commit 5953171

Please sign in to comment.