View Issue Details

This issue affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
16919Bug reportsOtherpublic2026-10-13 11:50
Reporterollehar Assigned Toc_schmitz  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version4.0.0dev 
Summary16919: Missing test suite for survey group permissions
Description

List of missing tests:

  • New field "Owner" in view "Create survey group" - test should save form and check that database value is updated correctly
TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)latest dev
I will donate to the project if issue is resolvedNo
Browser-
Database type & version-
Server OS (if known)-
Webserver software & version (if known)-
PHP Version-
Git branch / Pull Request URL

Relationships

related to 16440 closedcdorin Feature requests Survey group Permission : minimal system 

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2020-12-22 16:28

developer   ~61042

My opinion : we must start by a simple "Global settings" update Permission test suite ?
No ?

ollehar

ollehar

2020-12-22 16:31

reporter   ~61043

Well, our current approach was to grow a test suite from new features. That was my idea, at least. But should be collaborative effort by contributors and core GmbH team.

DenisChenu

DenisChenu

2020-12-22 16:55

developer   ~61044

PS : i don't mind of new form action test …

DenisChenu

DenisChenu

2020-12-22 18:15

developer   ~61053

Well, our current approach was to grow a test suite from new features. That was my idea, at least. But should be collaborative effort by contributors and core GmbH team.

Yes, i understand : and it's in my todo list since month to add SurveysGroup permission checker when there are a solution to do action other than superadmin :)

But you are right : i didn't mind of GUI test suite here …

DenisChenu

DenisChenu

2021-01-13 08:50

developer   ~61514

Update category (clearly not encryption here)

DenisChenu

DenisChenu

2021-01-13 08:53

developer   ~61515

@ollehar : i can easily add Survey permision checker
BUT :

Maybe i try an update of login user id directly in session ?

ollehar

ollehar

2021-01-13 10:25

reporter   ~61518

user can grant more permissions on a survey than he has himself

To make a test for this without database, you need to take the controller action and rip out everything that's not related to database or request parsing, and put it in a service class with injection or possibility to mock. In other words, business logic should be in service classes to be testable. :) But, let me merge your PR first and have a look.

DenisChenu

DenisChenu

2021-01-13 10:33

developer   ~61522

Then : mock Permission->save() and check if data sent via our mocked POST was in save data ?

And even if Permission->save happen for specific permission …

To mock :

  • Survey->havePermission() : send false to the current user for permisison1 and true for permission2
  • Permission->save() : check is save
    • didn't happen for permisison1
    • happen for permisison2
c_schmitz

c_schmitz

2026-10-12 20:16

administrator   ~86346

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=40801

LimeBot

LimeBot

2026-10-13 11:50

administrator   ~86418

Fixed in Release 7.6.0+261013

Related Changesets

LimeSurvey: master 9049efcc

2026-10-12 20:15

c_schmitz


Details Diff
Fixed issue 16919: Survey group owner field was not covered by tests
Dev Added SurveysGroupsOwnerTest for owner on create and owner change restriction on update
Affected Issues
16919
add - tests/unit/controllers/SurveysGroupsOwnerTest.php Diff File

Issue History

Date Modified Username Field Change
2020-12-22 16:22 ollehar New Issue
2020-12-22 16:22 ollehar Relationship added related to 16440
2020-12-22 16:22 ollehar Assigned To => DenisChenu
2020-12-22 16:22 ollehar Status new => assigned
2020-12-22 16:23 ollehar Description Updated
2020-12-22 16:24 ollehar Assigned To DenisChenu => ollehar
2020-12-22 16:28 DenisChenu Note Added: 61042
2020-12-22 16:31 ollehar Note Added: 61043
2020-12-22 16:55 DenisChenu Note Added: 61044
2020-12-22 18:15 DenisChenu Note Added: 61053
2021-01-13 08:50 DenisChenu Category Encryption => Other
2021-01-13 08:50 DenisChenu Note Added: 61514
2021-01-13 08:53 DenisChenu Note Added: 61515
2021-01-13 10:25 ollehar Note Added: 61518
2021-01-13 10:33 DenisChenu Note Added: 61522
2021-03-10 21:12 ollehar Product Version => 4.0.0dev
2026-10-12 20:16 c_schmitz Changeset attached => LimeSurvey master 9049efcc
2026-10-12 20:16 c_schmitz Note Added: 86346
2026-10-12 20:16 c_schmitz Assigned To ollehar => c_schmitz
2026-10-12 20:16 c_schmitz Status assigned => resolved
2026-10-12 20:16 c_schmitz Resolution open => fixed
2026-10-12 20:16 c_schmitz Bug heat 4 => 6
2026-10-13 11:50 LimeBot Note Added: 86418
2026-10-13 11:50 LimeBot Status resolved => closed
2026-10-13 11:50 LimeBot Bug heat 6 => 8