From 09ad2502602156854cdc222ae4eb28111259efd7 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 11 Apr 2020 14:23:52 +0200 Subject: [PATCH 1/4] fix: #1410 - webtools not enabled by default --- src/Builder/Project/Simple.php | 3 ++- tests/console/GenerateProjectCept.php | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Builder/Project/Simple.php b/src/Builder/Project/Simple.php index 9a3cf676a..8a13c926b 100644 --- a/src/Builder/Project/Simple.php +++ b/src/Builder/Project/Simple.php @@ -58,6 +58,7 @@ class Simple extends ProjectBuilder */ public function build() { + $this ->buildDirectories() ->getVariableValues() @@ -69,7 +70,7 @@ public function build() ->createControllerFile() ->createHtrouterFile(); - if ($this->options->has('enableWebTools')) { + if ($this->options->has('enableWebTools') && true === $this->options->enableWebTools) { Tools::install($this->options->get('projectPath')); } diff --git a/tests/console/GenerateProjectCept.php b/tests/console/GenerateProjectCept.php index 8bd30d02e..109967208 100644 --- a/tests/console/GenerateProjectCept.php +++ b/tests/console/GenerateProjectCept.php @@ -64,3 +64,27 @@ $I->seeFileFound(app_path($path4)); $I->seeFileFound(app_path($path4 . '/app/views/index.volt')); $I->deleteDir(app_path($path4)); + +/** + * Case 5 - Check webtools is disable by default + */ +$projectName5 = 'webtools_defaults'; +$path5 = $projectsFolder . '/' . $projectName5; + +$I->dontSeeFileFound(app_path($path5)); +$I->runShellCommand('phalcon project ' . $projectName5); +$I->dontSeeFileFound(app_path($path5 . '/public/webtools.php')); +$I->dontSeeFileFound(app_path($path5 . '/public/webtools.config.php')); +$I->deleteDir(app_path($path5)); + +/** + * Case 6 - Check webtools file when it's activated + */ +$projectName6 = 'webtools_activated'; +$path6 = $projectsFolder . '/' . $projectName6; + +$I->dontSeeFileFound(app_path($path6)); +$I->runShellCommand('phalcon project ' . $projectName6 . '--enable-webtools'); +$I->seeFileFound(app_path($path6 . '/public/webtools.php')); +$I->seeFileFound(app_path($path6 . '/public/webtools.config.php')); +$I->deleteDir(app_path($path6)); \ No newline at end of file From 4dfd6fd3cd43cb0a12f35d617107bcc1dff7719c Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 11 Apr 2020 14:25:19 +0200 Subject: [PATCH 2/4] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f734ea61e..ec2beb7c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,3 +7,4 @@ - Fixed include order of files in created project [#1417](https://github.com/phalcon/phalcon-devtools/issues/1417) - Fixed Scaffold templates errors and phpstan errors. [#1429](https://github.com/phalcon/phalcon-devtools/issues/1429) [@jenovateurs](https://github.com/jenovateurs) - Fixed duplicate camelCase properties [#1433](https://github.com/phalcon/phalcon-devtools/pull/1433) +- Fixed webtools not enabled by default when creating a new project [#1410](https://github.com/phalcon/phalcon-devtools/issues/1410) [@jenovateurs](https://github.com/jenovateurs) \ No newline at end of file From 86388de8cc1615b314ddeb978531e47ad3a64307 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 11 Apr 2020 14:31:42 +0200 Subject: [PATCH 3/4] fix: codacy issues --- tests/console/GenerateProjectCept.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/console/GenerateProjectCept.php b/tests/console/GenerateProjectCept.php index 109967208..8ef9c0978 100644 --- a/tests/console/GenerateProjectCept.php +++ b/tests/console/GenerateProjectCept.php @@ -65,7 +65,7 @@ $I->seeFileFound(app_path($path4 . '/app/views/index.volt')); $I->deleteDir(app_path($path4)); -/** +/** * Case 5 - Check webtools is disable by default */ $projectName5 = 'webtools_defaults'; @@ -77,7 +77,7 @@ $I->dontSeeFileFound(app_path($path5 . '/public/webtools.config.php')); $I->deleteDir(app_path($path5)); -/** +/** * Case 6 - Check webtools file when it's activated */ $projectName6 = 'webtools_activated'; @@ -87,4 +87,4 @@ $I->runShellCommand('phalcon project ' . $projectName6 . '--enable-webtools'); $I->seeFileFound(app_path($path6 . '/public/webtools.php')); $I->seeFileFound(app_path($path6 . '/public/webtools.config.php')); -$I->deleteDir(app_path($path6)); \ No newline at end of file +$I->deleteDir(app_path($path6)); From bca79e2929d0595cfa120aceea5dd475b3a06844 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 11 Apr 2020 14:53:09 +0200 Subject: [PATCH 4/4] fix: add space between project name and --enable --- tests/console/GenerateProjectCept.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/console/GenerateProjectCept.php b/tests/console/GenerateProjectCept.php index 8ef9c0978..f2f32ce46 100644 --- a/tests/console/GenerateProjectCept.php +++ b/tests/console/GenerateProjectCept.php @@ -84,7 +84,7 @@ $path6 = $projectsFolder . '/' . $projectName6; $I->dontSeeFileFound(app_path($path6)); -$I->runShellCommand('phalcon project ' . $projectName6 . '--enable-webtools'); +$I->runShellCommand('phalcon project ' . $projectName6 . ' --enable-webtools'); $I->seeFileFound(app_path($path6 . '/public/webtools.php')); $I->seeFileFound(app_path($path6 . '/public/webtools.config.php')); $I->deleteDir(app_path($path6));