Skip to content

Commit

Permalink
Update method/variable names.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Aug 4, 2014
1 parent 3166446 commit 24c099c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Console/Command/Task/BakeTask.php
Expand Up @@ -177,10 +177,10 @@ public function getOptionParser() {
'short' => 'c',
'default' => 'default',
'help' => __d('cake_console', 'The datasource connection to get data from.')
])->addOption('theme', [
])->addOption('template', [
'short' => 't',
'default' => 'default',
'help' => __d('cake_console', 'Theme to use when baking code.')
'help' => __d('cake_console', 'Template to use when baking code.')
]);
return $parser;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Command/Task/ProjectTask.php
Expand Up @@ -166,9 +166,9 @@ public function getOptionParser() {
])->addOption('empty', [
'boolean' => true,
'help' => __d('cake_console', 'Create empty files in each of the directories. Good if you are using git')
])->addOption('theme', [
])->addOption('template', [
'short' => 't',
'help' => __d('cake_console', 'Theme to use when baking code.')
'help' => __d('cake_console', 'Template to use when baking code.')
])->addOption('composer', [
'default' => ROOT . '/composer.phar',
'help' => __d('cake_console', 'The path to the composer executable.')
Expand Down
8 changes: 4 additions & 4 deletions src/Console/Command/Task/ViewTask.php
Expand Up @@ -380,19 +380,19 @@ public function getTemplate($action) {
if (!empty($this->template) && $action != $this->template) {
return $this->template;
}
$themePath = $this->Template->getThemePath();
$templatePath = $this->Template->getTemplatePath();

if (!empty($this->params['prefix'])) {
$prefixed = Inflector::underscore($this->params['prefix']) . '_' . $action;
if (file_exists($themePath . 'views/' . $prefixed . '.ctp')) {
if (file_exists($templatePath . 'views/' . $prefixed . '.ctp')) {
return $prefixed;
}
$generic = preg_replace('/(.*)(_add|_edit)$/', '\1_form', $prefixed);
if (file_exists($themePath . 'views/' . $generic . '.ctp')) {
if (file_exists($templatePath . 'views/' . $generic . '.ctp')) {
return $generic;
}
}
if (file_exists($themePath . 'views/' . $action . '.ctp')) {
if (file_exists($templatePath . 'views/' . $action . '.ctp')) {
return $action;
}
if (in_array($action, ['add', 'edit'])) {
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/Console/Command/Task/ViewTaskTest.php
Expand Up @@ -94,7 +94,7 @@ class ViewTaskTest extends TestCase {
/**
* setUp method
*
* Ensure that the default theme is used
* Ensure that the default template is used
*
* @return void
*/
Expand Down Expand Up @@ -124,7 +124,7 @@ protected function _setupTask($methods) {
$this->Task->Template = new TemplateTask($io);
$this->Task->Model = $this->getMock('Cake\Console\Command\Task\ModelTask', [], [$io]);

$this->Task->Template->params['theme'] = 'default';
$this->Task->Template->params['template'] = 'default';
$this->Task->Template->templatePaths = ['default' => CAKE . 'Template/Bake/default/'];
}

Expand Down Expand Up @@ -709,7 +709,7 @@ public function testGetTemplatePrefixed() {
$this->Task->Template->templatePaths = array(
'test' => CORE_TESTS . '/test_app/TestApp/Template/Bake/test/'
);
$this->Task->Template->params['theme'] = 'test';
$this->Task->Template->params['template'] = 'test';

$result = $this->Task->getTemplate('edit');
$this->assertEquals('admin_edit', $result);
Expand Down

0 comments on commit 24c099c

Please sign in to comment.