Skip to content

Commit

Permalink
Dev: fixed issues with travis + add notes for futur improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Aug 20, 2018
1 parent ff1ce15 commit 8146b2c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions application/helpers/frontend_helper.php
Expand Up @@ -749,6 +749,29 @@ function buildsurveysession($surveyid, $preview = false)

// Reset all the session variables and start again
resetAllSessionVariables($surveyid);

// NOTE: All of this is already done in survey controller.
// We keep it here only for Travis Tested thar are still not using Selenium
// As soon as the tests are rewrote to use selenium, those lines can be removed
$lang = $_SESSION['survey_'.$surveyid]['s_lang'];
if (empty($lang)){

// Multi lingual support order : by REQUEST, if not by Token->language else by survey default language

if (returnGlobal('lang', true)) {
$language_to_set = returnGlobal('lang', true);
} elseif (isset($oTokenEntry) && $oTokenEntry) {
// If survey have token : we have a $oTokenEntry
// Can use $oTokenEntry = Token::model($surveyid)->findByAttributes(array('token'=>$clienttoken)); if we move on another function : this par don't validate the token validity
$language_to_set = $oTokenEntry->language;
} else {
$language_to_set = $thissurvey['language'];
}
// Always SetSurveyLanguage : surveys controller SetSurveyLanguage too, if different : broke survey (#09769)
SetSurveyLanguage($surveyid, $language_to_set);
}


UpdateGroupList($surveyid, $_SESSION['survey_'.$surveyid]['s_lang']);

$totalquestions = $survey->countTotalQuestions;
Expand Down
3 changes: 3 additions & 0 deletions tests/questions/DateTimeDefaultAnswerExpressionTest.php
Expand Up @@ -33,6 +33,9 @@ public function testDefaultAnswerExpressionFill()

\Yii::app()->setConfig('surveyID', self::$surveyId);
\Yii::app()->setController(new DummyController('dummyid'));

// NOTE: This block us. We can't refactore buildsurveysession
// So as soon as the test are rewrote to use selenium, buildsurveysession TODOs can be done
buildsurveysession(self::$surveyId);
$surveyMode = 'group';
$LEMdebugLevel = 0;
Expand Down

0 comments on commit 8146b2c

Please sign in to comment.