Unit/System Tests Webservices PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
10 May 2026

Pull Request resolves #47740.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Add preprocessSaveData method to handle PATCH requests when no rules in the payload.

Testing Instructions

send a PATCH to /api/index.php/v1/users/levels/{id} that omits rules

{
"title": "ccTechnician"
}

Actual result BEFORE applying this Pull Request

HTTP 200, response body shows rules = [0]. The previous rules array is destroyed silently.

Expected result AFTER applying this Pull Request

only title is changed, rules is preserved.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar alikon alikon - open - 10 May 2026
avatar alikon alikon - change - 10 May 2026
Status New Pending
ab6d53b 10 May 2026 avatar alikon cs
avatar alikon alikon - change - 10 May 2026
Labels Added: Webservices PR-5.4-dev
avatar joomla-cms-bot joomla-cms-bot - change - 10 May 2026
Category JavaScript Unit Tests
avatar adarshdubey03 adarshdubey03 - test_item - 10 May 2026 - Tested successfully
avatar adarshdubey03
adarshdubey03 - comment - 10 May 2026

I have tested this item ✅ successfully on 516d1da

Tested Successfully!
Before the patch:

{
"errors": [
{
"title": "Field required: id"
}
]
}
And after the patch:

{
"links": {
"self": "http://localhost/joomla-cms/api/index.php/v1/users/levels"
},
"data": {
"type": "levels",
"id": "7",
"attributes": {
"id": 7,
"title": "aaTechnician",
"rules": [
1,
2
]
}
}
}


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar adarshdubey03
adarshdubey03 - comment - 10 May 2026

I have tested this item ✅ successfully on 516d1da

Tested Successfully!
Before the patch:

{
"errors": [
{
"title": "Field required: id"
}
]
}
And after the patch:

{
"links": {
"self": "http://localhost/joomla-cms/api/index.php/v1/users/levels"
},
"data": {
"type": "levels",
"id": "7",
"attributes": {
"id": 7,
"title": "aaTechnician",
"rules": [
1,
2
]
}
}
}


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar adarshdubey03
adarshdubey03 - comment - 10 May 2026

I have tested this item ✅ successfully on 516d1da

Tested Successfully!
Before the patch:

{
"errors": [
{
"title": "Field required: id"
}
]
}
And after the patch:

{
"links": {
"self": "http://localhost/joomla-cms/api/index.php/v1/users/levels"
},
"data": {
"type": "levels",
"id": "7",
"attributes": {
"id": 7,
"title": "aaTechnician",
"rules": [
1,
2
]
}
}
}


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar richard67
richard67 - comment - 10 May 2026

@adarshdubey03 Can it be that you have reported your test result in the wrong PR? This one here is still draft, and your test result fits better to #47748 .

avatar adarshdubey03 adarshdubey03 - test_item - 10 May 2026 - Not tested
avatar adarshdubey03
adarshdubey03 - comment - 10 May 2026

I have not tested this item.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar adarshdubey03
adarshdubey03 - comment - 10 May 2026

I have not tested this item.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar alikon alikon - change - 11 May 2026
Labels Added: Unit/System Tests
avatar alikon
alikon - comment - 11 May 2026

the test failure will be solved when pr #47748 will be merged

avatar QuyTon QuyTon - test_item - 25 May 2026 - Tested successfully
avatar QuyTon
QuyTon - comment - 25 May 2026

I have tested this item ✅ successfully on a9e23e0


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar QuyTon
QuyTon - comment - 25 May 2026

I have tested this item ✅ successfully on a9e23e0


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar github-actions[bot]
github-actions[bot] - comment - 27 May 2026

This pull request has conflicts, please resolve those before we can evaluate the pull request.

avatar richard67
richard67 - comment - 27 May 2026

@alikon Could you fix the conflict in file tests/System/integration/api/com_users/Levels.cy.js? It is caused by your other PR #47748 having just been merged.

avatar alikon
alikon - comment - 27 May 2026

yes sure i'll do it

avatar alikon alikon - change - 27 May 2026
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2026-05-27 12:54:45
Closed_By alikon
Labels Added: Conflicting Files
avatar alikon alikon - close - 27 May 2026
avatar alikon alikon - change - 27 May 2026
Status Closed New
Closed_Date 2026-05-27 12:54:45
Closed_By alikon
avatar alikon alikon - change - 27 May 2026
Status New Pending
avatar alikon alikon - reopen - 27 May 2026
avatar alikon alikon - change - 27 May 2026
Labels Removed: Conflicting Files
avatar exlemor exlemor - test_item - 29 May 2026 - Tested successfully
avatar exlemor
exlemor - comment - 29 May 2026

I have tested this item ✅ successfully on 27b6eef

I was able to test this during the May 29th Friday PR Testing Session - using Postman. Thanks @alikon!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar exlemor
exlemor - comment - 29 May 2026

I have tested this item ✅ successfully on 27b6eef

I was able to test this during the May 29th Friday PR Testing Session - using Postman. Thanks @alikon!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar QuyTon QuyTon - alter_testresult - 29 May 2026 - QuyTon: Tested successfully
avatar QuyTon QuyTon - change - 29 May 2026
Status Pending Ready to Commit
avatar QuyTon
QuyTon - comment - 29 May 2026

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar QuyTon
QuyTon - comment - 29 May 2026

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar muhme muhme - change - 4 Jun 2026
Labels Added: RTC
avatar muhme muhme - test_item - 4 Jun 2026 - Tested unsuccessfully
avatar muhme
muhme - comment - 4 Jun 2026

I have tested this item 🔴 unsuccessfully on dd03760

✅ Final test before merge with JBT

  • Used e.g. api_call "GET" "/v1/users/levels/1"
  • Before PR seen api_call "PATCH" "/v1/users/levels/1" -d "{\"title\": \"IT suport\"}" is destroying rules array
  • First aplied only the modified System Test file and running scripts/test 54 system api/com_users/Levels.cy.js
    • ❌ Surprisingly, all five tests passed, so they do not currently cover the actual regression.
      • The can update a users access level test does not cover the actual regression: the rules array is destroyed when updating another attribute.
      • Could the test be extended to store the complete object before patching and compare it afterwards? In this case, the test would fail before the fix and would be a real regression test.
  • ✅ After applying the PR with Patch Tester, updating the title attribute correctly leaves the rules array unchanged.
    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.
avatar muhme
muhme - comment - 4 Jun 2026

I have tested this item 🔴 unsuccessfully on dd03760

✅ Final test before merge with JBT

  • Used e.g. api_call "GET" "/v1/users/levels/1"
  • Before PR seen api_call "PATCH" "/v1/users/levels/1" -d "{\"title\": \"IT suport\"}" is destroying rules array
  • First aplied only the modified System Test file and running scripts/test 54 system api/com_users/Levels.cy.js
    • ❌ Surprisingly, all five tests passed, so they do not currently cover the actual regression.
      • The can update a users access level test does not cover the actual regression: the rules array is destroyed when updating another attribute.
      • Could the test be extended to store the complete object before patching and compare it afterwards? In this case, the test would fail before the fix and would be a real regression test.
  • ✅ After applying the PR with Patch Tester, updating the title attribute correctly leaves the rules array unchanged.
    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.
avatar muhme
muhme - comment - 4 Jun 2026

I have tested this item 🔴 unsuccessfully on dd03760

Final test before merge with JBT

  • Used e.g. api_call "GET" "/v1/users/levels/1"
  • Before PR seen api_call "PATCH" "/v1/users/levels/1" -d "{\"title\": \"IT suport\"}" is destroying rules array
  • First aplied only the modified System Test file and running scripts/test 54 system api/com_users/Levels.cy.js
    • ❌ Surprisingly, all five tests passed, so they do not currently cover the actual regression.
      • The can update a users access level test does not cover the actual regression: the rules array is destroyed when updating another attribute.
      • Could the test be extended to store the complete object before patching and compare it afterwards? In this case, the test would fail before the fix and would be a real regression test.
  • ✅ After applying the PR with Patch Tester, updating the title attribute correctly leaves the rules array unchanged.
    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.
avatar muhme muhme - change - 4 Jun 2026
Status Ready to Commit Pending
avatar muhme
muhme - comment - 4 Jun 2026

back to pending


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar muhme
muhme - comment - 4 Jun 2026

back to pending


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47751.

avatar alikon
alikon - comment - 4 Jun 2026

@muhme just to understand
so the issue #47740 is fixed what are you complianing is the need of one more test to cover the scenario:
"store the complete object before patching and compare it afterwards"

I'am correct ?

avatar alikon
alikon - comment - 4 Jun 2026

@muhme just to understand
so the issue #47740 is fixed what are you complaining is the need of one more test to cover the scenario:
"store the complete object before patching and compare it afterwards"

I'am correct ?

avatar muhme
muhme - comment - 4 Jun 2026

@alikon First, thank you for your contribution and for updating the System Tests 👍

What I am asking about is, the updated can update a users access level test doesn't cover this PRs and the issue. The destroyed rules array isn't checked. The test passes even before this PR fix.

Would it make sense to extend the test by storing the complete object before the update and comparing it afterwards? In that case, the test would fail before the fix and passed afterwards.

avatar alikon alikon - change - 4 Jun 2026
Labels Removed: RTC
avatar muhme
muhme - comment - 4 Jun 2026

✅ Counting still as RTC as only System Tests are changed and they passed

avatar muhme
muhme - comment - 4 Jun 2026

✅ Final Re-test before merge with JBT

  • Initially, only the modified system test file was used and seen test can patch a users access level and check the rules fails
  • Applied PR with patch tester
    • Updating the title attribute correctly leaves the rules array unchanged
    • All System Tests are passing
avatar muhme muhme - change - 4 Jun 2026
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2026-06-04 09:48:34
Closed_By muhme
avatar muhme muhme - close - 4 Jun 2026
avatar muhme muhme - merge - 4 Jun 2026
avatar muhme
muhme - comment - 4 Jun 2026

Thank you very much @alikon for your contribution and extending the System Tests. Thanks to @QuyTon and @exlemor for testing.

Add a Comment

Login with GitHub to post a comment