View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
19927Bug reportsInstallationpublic2025-01-29 16:36
ReporterRyszard Assigned Totibor.pacalat  
PrioritynoneSeverityblock 
Status resolvedResolutionfixed 
Product Version6.6.x 
Summary19927: postgres and unit tests
Description

I have installed the latest version of LimeSurvey 6.10.0. As the first step, I ran the unit tests. When using MySQL, all the tests pass successfully (100%). However, when using PostgreSQL, several errors occur. (2 errors, 4 failures)

Steps To Reproduce

Steps to reproduce

git clone
run installer: http://127.0.0.1/index.php?r=installer/welcome
composer install
DROP DATABASE limesurvey; CREATE DATABASE limesurvey;
php application/commands/console.php install admin password TravisLS no@email.com verbose
touch enabletests
chmod 777 tests/tmp/
DOMAIN=localhost ./vendor/bin/phpunit tests/unit

Expected result

Unit tests passed:
OK, but incomplete, skipped, or risky tests!
Tests: 558, Assertions: 18585, Skipped: 5.

Actual result

There were 2 errors:

1) ls\tests\LSYiiValidatorsTest::testLanguageFilters
2) ls\tests\GroupHelperTest::testQuestionGroupChange

There were 4 failures:

1) ls\tests\GroupHelperTest::testQuestionGroupChangeOnActiveSurvey
2) ls\tests\CPDImportParticpantsTest::testParticipantWithOneAttributeImportedSucessfully
3) ls\tests\CPDImportParticpantsTest::testParticipantUpdatedSuccessfullyWhenUpdateTrue
4) ls\tests\CPDImportParticpantsTest::testParticipantWithOneEncryptedAttributeImportedSucessfully

ERRORS!
Tests: 558, Assertions: 1643, Errors: 2, Failures: 4, Skipped: 13.

TagsNo tags attached.
Attached Files
postresql unit tests logs.txt (3,023 bytes)   
There were 2 errors:

1) ls\tests\LSYiiValidatorsTest::testLanguageFilters
CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type integer: ""
LINE 1: ...ssions.entity='surveysgroups' AND permissions.uid='')  LEFT ...
                                                             ^

/var/www/html/vendor/yiisoft/yii/framework/db/CDbCommand.php:543
/var/www/html/vendor/yiisoft/yii/framework/db/CDbCommand.php:396
/var/www/html/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php:1359
/var/www/html/application/models/LSActiveRecord.php:77
/var/www/html/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php:1478
/var/www/html/application/models/SurveysGroups.php:356
/var/www/html/application/models/Survey.php:518
/var/www/html/vendor/yiisoft/yii/framework/base/CModel.php:284
/var/www/html/vendor/yiisoft/yii/framework/base/CModel.php:260
/var/www/html/vendor/yiisoft/yii/framework/base/CModel.php:158
/var/www/html/application/models/Survey.php:969
/var/www/html/tests/unit/LSYiiValidatorsTest.php:296
/var/www/html/vendor/bin/phpunit:122

2) ls\tests\GroupHelperTest::testQuestionGroupChange
CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "Q03" does not exist
LINE 3: WHERE (title = "Q03") AND (sid=194594)
                       ^

/var/www/html/vendor/yiisoft/yii/framework/db/CDbCommand.php:543
/var/www/html/vendor/yiisoft/yii/framework/db/CDbCommand.php:377
/var/www/html/tests/unit/helpers/GroupHelperTest.php:169
/var/www/html/vendor/bin/phpunit:122

--

There were 4 failures:

1) ls\tests\GroupHelperTest::testQuestionGroupChangeOnActiveSurvey
Apparently, the question was moved from one group to another, this should not happen in active surveys.
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'error'
+'success'

/var/www/html/tests/unit/helpers/GroupHelperTest.php:212
/var/www/html/vendor/bin/phpunit:122

2) ls\tests\CPDImportParticpantsTest::testParticipantWithOneAttributeImportedSucessfully
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://www.example.com'
+''

/var/www/html/tests/unit/helpers/remotecontrol/CPDImportParticpantsTest.php:145
/var/www/html/vendor/bin/phpunit:122

3) ls\tests\CPDImportParticpantsTest::testParticipantUpdatedSuccessfullyWhenUpdateTrue
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://www.example.org'
+''

/var/www/html/tests/unit/helpers/remotecontrol/CPDImportParticpantsTest.php:194
/var/www/html/vendor/bin/phpunit:122

4) ls\tests\CPDImportParticpantsTest::testParticipantWithOneEncryptedAttributeImportedSucessfully
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'123456789'
+''

/var/www/html/tests/unit/helpers/remotecontrol/CPDImportParticpantsTest.php:283
/var/www/html/vendor/bin/phpunit:122

ERRORS!
Tests: 558, Assertions: 1643, Errors: 2, Failures: 4, Skipped: 13.

postresql unit tests logs.txt (3,023 bytes)   
Bug heat6
Complete LimeSurvey version number (& build)'6.10.0' ('')
I will donate to the project if issue is resolvedNo
Browsernope
Database type & versionpostgres 15
Server OS (if known)Debian GNU/Linux 12 (bookworm)
Webserver software & version (if known)
PHP Version8.3

Users monitoring this issue

Ryszard

Activities

gabrieljenik

gabrieljenik

2025-01-17 20:55

manager   ~81841

https://github.com/LimeSurvey/LimeSurvey/pull/4137

gabrieljenik

gabrieljenik

2025-01-20 17:23

manager   ~81856

https://github.com/LimeSurvey/LimeSurvey/pull/4137/files/1ff883e4d83be51864ff2eb86a3152847f83dfed#diff-c2e2b37076b5bae18bcd942f811752f5be549ebcec44fd866ffbba17662ca35eR422

Not related to this issue, but if the permission checking returns false, and somehow, there is no user id logged, the query will fail on postgre (as failed during the test). Not sure when the userId could be empty, maybe if called when survey taking?
Just leaving it here in case it rings a bell

DenisChenu

DenisChenu

2025-01-20 17:37

developer   ~81860

maybe if called when survey taking?

I think if we call SurveysGroups list dureing survey taking : it's the issue : no need SurveysGroups list during survey taking

Else : in this casee : https://github.com/LimeSurvey/LimeSurvey/blob/5159bbf6ec56de7ab75fa8d1aeb225e0366dd382/application/models/Permission.php#L567 we must return an empty array (same for Survey listing)

Issue History

Date Modified Username Field Change
2025-01-09 12:44 Ryszard New Issue
2025-01-09 12:44 Ryszard File Added: postresql unit tests logs.txt
2025-01-09 12:46 Ryszard Issue Monitored: Ryszard
2025-01-09 12:46 Ryszard Bug heat 0 => 2
2025-01-09 13:20 tibor.pacalat Assigned To => gabrieljenik
2025-01-09 13:20 tibor.pacalat Status new => assigned
2025-01-17 20:55 gabrieljenik Assigned To gabrieljenik => DenisChenu
2025-01-17 20:55 gabrieljenik Status assigned => ready for code review
2025-01-17 20:55 gabrieljenik Note Added: 81841
2025-01-17 20:55 gabrieljenik Bug heat 2 => 4
2025-01-20 17:23 gabrieljenik Note Added: 81856
2025-01-20 17:37 DenisChenu Note Added: 81860
2025-01-20 17:37 DenisChenu Bug heat 4 => 6
2025-01-20 17:37 DenisChenu Assigned To DenisChenu => tibor.pacalat
2025-01-20 17:37 DenisChenu Status ready for code review => ready for testing
2025-01-29 16:36 tibor.pacalat Status ready for testing => resolved
2025-01-29 16:36 tibor.pacalat Resolution open => fixed