mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Added -empty flag for ProjectTask to bake with empty dir files, tests included
Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
parent
6b3b2a629b
commit
cd6fd74caf
2 changed files with 49 additions and 1 deletions
|
@ -149,6 +149,9 @@ class ProjectTask extends Shell {
|
|||
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');
|
||||
|
||||
$Folder = new Folder($skel);
|
||||
if (!empty($this->params['empty'])) {
|
||||
$skip = array();
|
||||
}
|
||||
if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
|
||||
$this->hr();
|
||||
$this->out(sprintf(__("Created: %s in %s", true), $app, $path));
|
||||
|
|
|
@ -115,6 +115,51 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
|
||||
}
|
||||
|
||||
/**
|
||||
* test bake() method with -empty flag, directory creation and empty files.
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testBakeEmptyFlag() {
|
||||
$this->Task->params['empty'] = true;
|
||||
$this->_setupTestProject();
|
||||
$path = $this->Task->path . 'bake_test_app';
|
||||
$this->assertTrue(is_dir($path), 'No project dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'controllers'), 'No controllers dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'controllers' . DS .'components'), 'No components dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'models'), 'No models dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'views'), 'No views dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'tests'), 'No tests dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'cases'), 'No cases dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'groups'), 'No groups dir %s');
|
||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
|
||||
|
||||
$this->assertTrue(is_file($path . DS . 'controllers' . DS .'components' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'locale' . DS . 'eng' . DS . 'LC_MESSAGES' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'models' . DS . 'behaviors' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'models' . DS . 'datasources' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'plugins' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'behaviors' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'components' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'controllers' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'datasources' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'helpers' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'cases' . DS . 'shells' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'fixtures' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'tests' . DS . 'groups' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'vendors' . DS . 'css' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'vendors' . DS . 'img' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'vendors' . DS . 'js' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'vendors' . DS . 'shells' . DS . 'tasks' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'views' . DS . 'errors' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'views' . DS . 'helpers' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'views' . DS . 'scaffolds' . DS . 'empty'), 'No empty file in dir %s');
|
||||
$this->assertTrue(is_file($path . DS . 'webroot' . DS . 'js' . DS . 'empty'), 'No empty file in dir %s');
|
||||
}
|
||||
|
||||
/**
|
||||
* test generation of Security.salt
|
||||
*
|
||||
|
@ -141,7 +186,7 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
*/
|
||||
function testIndexPhpGeneration() {
|
||||
$this->_setupTestProject();
|
||||
|
||||
|
||||
$path = $this->Task->path . 'bake_test_app' . DS;
|
||||
$this->Task->corePath($path);
|
||||
|
||||
|
|
Loading…
Reference in a new issue