View Issue Details

This issue affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
16771Bug reportsOtherpublic2026-11-20 12:23
Reporterollehar Assigned To 
PrioritynoneSeverityminor 
Status acknowledgedResolutionopen 
Summary16771: Create unit-tests for all (some?) events
Description

Having events break is bad. Unit-tests would make sure we don't break compatibility by mistake, like with question attributes.

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)
I will donate to the project if issue is resolved
Browser
Database type & version
Server OS (if known)
Webserver software & version (if known)
PHP Version
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2020-10-21 19:09

developer   ~60348

core plugins can be used for events testing.
I think it's the only way to really check it …

ollehar

ollehar

2020-10-22 11:26

reporter   ~60353

I was hoping a test suite could be created independent of installing plugins etc. We can't make a core plugin for every event in the software.

DenisChenu

DenisChenu

2020-10-22 11:32

developer   ~60355

You just check if the event happen, not if it does the functionality.

You spoke for question attributes :
4.0 : work in Question (public survey get the value) , but not when save or reload in admin GUI
4.3.22 : work in admin GUI, but not when really needed (in public survey)

ollehar

ollehar

2020-10-22 11:37

reporter   ~60356

You just check if the event happen, not if it does the functionality.

Hm! If we have a function foo() that contains event E, then we must check that the return values of foo() can be affected by E properly.

DenisChenu

DenisChenu

2020-10-22 12:37

developer   ~60360

Yes, sure : but : in my opinion it's really complex to know what exact function use it :).
It can be great to have whole, and greater to have core plugin with real usage ;)

ollehar

ollehar

2020-10-22 12:40

reporter   ~60361

Last edited: 2020-10-22 12:40

Well, then we need to do integrity tests to test that plugin. Not fun.

Related Changesets

LimeSurvey: master 704a6627

2026-11-20 12:22

c_schmitz


Details Diff
Dev Added unit tests for the plugin events of survey activation and deactivation, of saving and deleting responses and participants, and of taking a survey (issue 16771)
Dev Events covered: before/afterSurveyActivate, before/afterSurveyDeactivate, before/afterResponseSave, before/afterResponseDelete, before/afterTokenSave, before/afterTokenDelete, before/afterModelSave, before/afterModelDelete, afterFindSurvey, beforeSurveyPage, beforeQuestionRender and afterSurveyComplete
Dev setNoAnswerMode() no longer defines SHOW_NO_ANSWER and PRESELECT_NO_ANSWER a second time, so tests can render several survey pages in one process
Affected Issues
16771
mod - application/helpers/qanda_helper.php Diff File
add - tests/data/plugins/EventRecorderPlugin.php Diff File
add - tests/unit/events/ResponseAndParticipantModelEventsTest.php Diff File
add - tests/unit/events/SurveyActivationEventsTest.php Diff File
add - tests/unit/events/SurveyRuntimeEventsTest.php Diff File

Issue History

Date Modified Username Field Change
2020-10-21 17:52 ollehar New Issue
2020-10-21 17:52 ollehar Description Updated
2020-10-21 19:09 DenisChenu Note Added: 60348
2020-10-22 11:26 ollehar Note Added: 60353
2020-10-22 11:32 DenisChenu Note Added: 60355
2020-10-22 11:37 ollehar Note Added: 60356
2020-10-22 12:37 DenisChenu Note Added: 60360
2020-10-22 12:40 ollehar Note Added: 60361
2020-10-22 12:40 ollehar Note Edited: 60361
2026-11-19 22:50 c_schmitz Status new => acknowledged
2026-11-20 12:23 c_schmitz Changeset attached => LimeSurvey master 704a6627