From a5d26b93e9aade8748bf2bf0381688bb7d3d24ec Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 15 Dec 2020 16:20:44 +0100 Subject: [PATCH] :white_check_mark: ThemeHandlerTest : rename source files They are used solely in the test. And the test does the SCSS compilation and compares the results to expected files. So changing anything in the test source SCSS and we need to change the expected results too ! This isn"t necessary... But there were some confusions as the css/light-grey.scss file is modified very often, and one of the test source file has the same name ! Adding the prefix DO_NOT_CHANGE should avoid such errors in the future O:) --- test/application/ThemeHandlerTest.php | 18 +++++++++--------- ...s.scss => DO_NOT_CHANGE.css-variables.scss} | 0 ...grey.scss => DO_NOT_CHANGE.light-grey.scss} | 0 ...ueryui.scss => DO_NOT_CHANGE.jqueryui.scss} | 0 .../themes/basque-red/theme-parameters.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) rename test/application/theme-handler/expected/css/{css-variables.scss => DO_NOT_CHANGE.css-variables.scss} (100%) rename test/application/theme-handler/expected/css/{light-grey.scss => DO_NOT_CHANGE.light-grey.scss} (100%) rename test/application/theme-handler/expected/css/ui-lightness/{jqueryui.scss => DO_NOT_CHANGE.jqueryui.scss} (100%) diff --git a/test/application/ThemeHandlerTest.php b/test/application/ThemeHandlerTest.php index 6e2802e64..466f1f99a 100644 --- a/test/application/ThemeHandlerTest.php +++ b/test/application/ThemeHandlerTest.php @@ -312,9 +312,9 @@ JSON; public function CompileThemesProviderEmptyArray() { - $aEmptyImports = '{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":[],"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/jqueryui.scss","main":"..\/css\/light-grey.scss"}}'; - $aEmptyStyleSheets='{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":{"css-variables":"..\/css\/css-variables.scss"},"stylesheets":[]}'; - $aEmptyVars='{"variables":[],"imports":{"css-variables":"..\/css\/css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/jqueryui.scss","main":"..\/css\/light-grey.scss"}}'; + $aEmptyImports = '{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":[],"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"}}'; + $aEmptyStyleSheets='{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":[]}'; + $aEmptyVars='{"variables":[],"imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"}}'; return [ "empty imports" => [$aEmptyImports], "empty styles" => [$aEmptyStyleSheets], @@ -327,14 +327,14 @@ JSON; */ public function CompileThemesProvider() { - $sModifiedVariableThemeParameterJson='{"variables":{"brand-primary1":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":{"css-variables":"..\/css\/css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/jqueryui.scss","main":"..\/css\/light-grey.scss"}}'; - $sInitialThemeParamJson='{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":{"css-variables":"..\/css\/css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/jqueryui.scss","main":"..\/css\/light-grey.scss"}}'; - $sImportFilePath = '/branding/css/css-variables.scss'; + $sModifiedVariableThemeParameterJson='{"variables":{"brand-primary1":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"}}'; + $sInitialThemeParamJson='{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"}}'; + $sImportFilePath = '/branding/css/DO_NOT_CHANGE.css-variables.scss'; $sVarChangedMainCssPath="test/application/theme-handler/expected/themes/basque-red/main_varchanged.css"; $sStylesheetMainCssPath="test/application/theme-handler/expected/themes/basque-red/main_stylesheet.css"; $sImageMainCssPath="test/application/theme-handler/expected/themes/basque-red/main_imagemodified.css"; $sImportModifiedMainCssPath="test/application/theme-handler/expected/themes/basque-red/main_importmodified.css"; - $sStylesheetFilePath = '/branding/css/light-grey.scss'; + $sStylesheetFilePath = '/branding/css/DO_NOT_CHANGE.light-grey.scss'; $sImageFilePath = 'test/application/theme-handler/copied/testimages/images/green-header.gif'; return [ "setup context: variables list modified without any file touched" => [$sModifiedVariableThemeParameterJson, 1,false,false,false,$sImportFilePath, $sVarChangedMainCssPath], @@ -386,7 +386,7 @@ JSON; $this->recurse_copy(APPROOT.'test/application/theme-handler/expected/testimages/', $sAbsoluteImagePath); //change approot-relative in css-variable to use absolute path - $sCssVarPath = $this->sTmpDir."/branding/css/css-variables.scss"; + $sCssVarPath = $this->sTmpDir."/branding/css/DO_NOT_CHANGE.css-variables.scss"; $sBeforeReplacementCssVariableMd5sum = md5_file($sCssVarPath); echo 'BEFORE :'.$sBeforeReplacementCssVariableMd5sum.' '.$sCssVarPath.' '; $sCssVariableContent = file_get_contents($sCssVarPath); @@ -583,7 +583,7 @@ SCSS; public function testGetIncludedImages() { $aStylesheetFile=glob($this->sTmpDir."/branding/css/*.scss"); - $aStylesheetFile[]=$this->sTmpDir."/branding/css/ui-lightness/jqueryui.scss"; + $aStylesheetFile[]=$this->sTmpDir."/branding/css/ui-lightness/DO_NOT_CHANGE.jqueryui.scss"; $expectJsonFilePath = APPROOT.'test/application/theme-handler/expected/themes/basque-red/theme-parameters.json'; $expectedThemeParamJson = file_get_contents($expectJsonFilePath); $aThemeParametersVariables = json_decode($expectedThemeParamJson, true); diff --git a/test/application/theme-handler/expected/css/css-variables.scss b/test/application/theme-handler/expected/css/DO_NOT_CHANGE.css-variables.scss similarity index 100% rename from test/application/theme-handler/expected/css/css-variables.scss rename to test/application/theme-handler/expected/css/DO_NOT_CHANGE.css-variables.scss diff --git a/test/application/theme-handler/expected/css/light-grey.scss b/test/application/theme-handler/expected/css/DO_NOT_CHANGE.light-grey.scss similarity index 100% rename from test/application/theme-handler/expected/css/light-grey.scss rename to test/application/theme-handler/expected/css/DO_NOT_CHANGE.light-grey.scss diff --git a/test/application/theme-handler/expected/css/ui-lightness/jqueryui.scss b/test/application/theme-handler/expected/css/ui-lightness/DO_NOT_CHANGE.jqueryui.scss similarity index 100% rename from test/application/theme-handler/expected/css/ui-lightness/jqueryui.scss rename to test/application/theme-handler/expected/css/ui-lightness/DO_NOT_CHANGE.jqueryui.scss diff --git a/test/application/theme-handler/expected/themes/basque-red/theme-parameters.json b/test/application/theme-handler/expected/themes/basque-red/theme-parameters.json index 80e9f2f75..d5c7c19a6 100644 --- a/test/application/theme-handler/expected/themes/basque-red/theme-parameters.json +++ b/test/application/theme-handler/expected/themes/basque-red/theme-parameters.json @@ -1 +1 @@ -{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":{"css-variables":"..\/css\/css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/jqueryui.scss","main":"..\/css\/light-grey.scss"}} \ No newline at end of file +{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"}} \ No newline at end of file