Skip to content
Permalink
Browse files

Remove empty files for test and plugin bakes

  • Loading branch information...
bcrowe committed Sep 26, 2014
1 parent 42d4921 commit bf4c69a97a31ad081102f412abaf35c5b74fe412
Showing with 20 additions and 0 deletions.
  1. +2 −0 src/Shell/Task/PluginTask.php
  2. +18 −0 src/Shell/Task/TestTask.php
@@ -138,6 +138,8 @@ public function bake($plugin) {
$out .= "class AppController extends BaseController {\n\n";
$out .= "}\n";
$this->createFile($this->path . $plugin . DS . $classBase . DS . 'Controller' . DS . $controllerFileName, $out);
$emptyFile = $this->path . 'empty';
$this->_deleteEmptyFile($emptyFile);
$hasAutoloader = $this->_modifyAutoloader($plugin, $this->path);
$this->_generateRoutes($plugin, $this->path);
@@ -209,6 +209,8 @@ public function bake($type, $className) {
$out = $this->Template->generate('classes', 'test');
$filename = $this->testCaseFileName($type, $fullClassName);
$emptyFile = $this->getPath() . $this->getSubspacePath($type) . DS . 'empty';
$this->_deleteEmptyFile($emptyFile);
if ($this->createFile($filename, $out)) {
return $out;
}
@@ -272,6 +274,22 @@ public function getRealClassName($type, $class) {
return $namespace . '\\' . $subSpace . '\\' . $class;
}
/**
* Gets the subspace path for a test.
*
* @param string $type The Type of object you are generating tests for eg. controller.
* @return string Path of the subspace.
*/
public function getSubspacePath($type) {
$namespace = Configure::read('App.namespace');
if ($this->plugin) {
$namespace = $this->plugin;
}
$suffix = $this->classSuffixes[strtolower($type)];
$subspace = $this->mapType($type);
return str_replace('\\', DS, $subspace);
}
/**
* Map the types that TestTask uses to concrete types that App::className can use.
*

0 comments on commit bf4c69a

Please sign in to comment.
You can’t perform that action at this time.