From 09ad2502602156854cdc222ae4eb28111259efd7 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 11 Apr 2020 14:23:52 +0200 Subject: [PATCH] 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