GSoC/GCI Archive
Google Code-in 2011 LimeSurvey

Add Unit Tests for all Expression Manager Functions

completed by: Aaron Schmitz

mentors: TMSWhite

LimeSurvey 2.0a (our latest development release) is based on the CodeIgniter framework. Unfortunately the CodeIgniter license is not compatible to the LimeSurvey GPL license so we need to port the LimeSurvey codebase to a new framework, Yii. We need your help to do this.

General Steps:

  • Install a subversion client and download LimeSurvey 2.0a (that's the version still based on CodeIgniter) using subversion and install it by running http://<yourserver>/limesurvey/index.php/admin
  • Do the same with the new LimeSurvey development branch based on Yii. There is no installer yet so just point the database configuration in /application/config.php to the database you created in step 1.
  • Check out the functionality named in this task title in the CI version. If you have problems to find it please get in touch with us on IRC.
  • Check out the source code and then port the functionality to Yii.
  • Test the new functionality in the Yii version thoroughly.
  • Submit a patch created with subversion and based on the YII branch to this task idea and wait for feedback.

Specific Steps for This Task

  • Review the Expression Manager (EM) documentation and survey-building how-tos, and notes for developers.
  • For this task, edit UnitTestEvaluator() function in /application/helpers/expressions/em_core_helper.php
  • Add test cases for all functions listed in the amValidFunctions array in that php file.  For functions that accept variable numbers of parameters, ensure you test every possible option.
  • View the results using /admin/expressions/test/unit.php
  • Ensure that that the PHP and JavaScript versions of each test generate identical results.  All of 'PHP Results' and 'JavaScript Results' columns should be colored green.
  • If you can debug cases where the JavaScript and PHP results don't match, great, but that is not needed.  The goal is to have a comprehensive set of unit tests so that we can later debug cases where PHP and JavaScript conflict.
  • Adding other tests of other operators would be helpful, but is not required.
  • You can do this testing within the _CI branch - you don't need to do it in the Yii branch.


  • Good PHP knowledge
  • Experience with a PHP MVC framework


  • It is important that you test your ported code thoroughly before you submit the patch. This will save you and us alot of time. It will take longer to accept your patch if you did not test.