Skip to content

Commit

Permalink
Fix an issue when generating tests for lowercase type names.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 31, 2014
1 parent b9f0f3c commit 08289ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/Console/Command/Task/TestTask.php
Expand Up @@ -66,12 +66,12 @@ class TestTask extends BakeTask {
* @var array
*/
public $classSuffixes = [
'Entity' => '',
'Table' => 'Table',
'Controller' => 'Controller',
'Component' => 'Component',
'Behavior' => 'Behavior',
'Helper' => 'Helper'
'entity' => '',
'table' => 'Table',
'controller' => 'Controller',
'component' => 'Component',
'behavior' => 'Behavior',
'helper' => 'Helper'
];

/**
Expand Down Expand Up @@ -264,7 +264,7 @@ public function getRealClassName($type, $class) {
if ($this->plugin) {
$namespace = Plugin::getNamespace($this->plugin);
}
$suffix = $this->classSuffixes[$type];
$suffix = $this->classSuffixes[strtolower($type)];
$subSpace = $this->mapType($type);
if ($suffix && strpos($class, $suffix) === false) {
$class .= $suffix;
Expand Down
12 changes: 6 additions & 6 deletions tests/TestCase/Console/Command/Task/TestTaskTest.php
Expand Up @@ -264,17 +264,17 @@ public function testGetUserFixtures() {
public static function realClassProvider() {
return [
['Entity', 'Article', 'App\Model\Entity\Article'],
['Entity', 'ArticleEntity', 'App\Model\Entity\ArticleEntity'],
['entity', 'ArticleEntity', 'App\Model\Entity\ArticleEntity'],
['Table', 'Posts', 'App\Model\Table\PostsTable'],
['Table', 'PostsTable', 'App\Model\Table\PostsTable'],
['table', 'PostsTable', 'App\Model\Table\PostsTable'],
['Controller', 'Posts', 'App\Controller\PostsController'],
['Controller', 'PostsController', 'App\Controller\PostsController'],
['controller', 'PostsController', 'App\Controller\PostsController'],
['Behavior', 'Timestamp', 'App\Model\Behavior\TimestampBehavior'],
['Behavior', 'TimestampBehavior', 'App\Model\Behavior\TimestampBehavior'],
['behavior', 'TimestampBehavior', 'App\Model\Behavior\TimestampBehavior'],
['Helper', 'Form', 'App\View\Helper\FormHelper'],
['Helper', 'FormHelper', 'App\View\Helper\FormHelper'],
['helper', 'FormHelper', 'App\View\Helper\FormHelper'],
['Component', 'Auth', 'App\Controller\Component\AuthComponent'],
['Component', 'AuthComponent', 'App\Controller\Component\AuthComponent'],
['component', 'AuthComponent', 'App\Controller\Component\AuthComponent'],
];
}

Expand Down

0 comments on commit 08289ba

Please sign in to comment.