From ff8c3fed5d45643adbc5d5d4a6dfe5061c08c0a7 Mon Sep 17 00:00:00 2001 From: nwcm <111259588+nwcm@users.noreply.github.com> Date: Thu, 20 Nov 2025 14:17:27 +1100 Subject: [PATCH 1/2] fix: order test for inner query --- .../test/classes/fflib_SObjectSelectorTest.cls | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 63b2d837b4..989b4b5f28 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -456,10 +456,14 @@ private with sharing class fflib_SObjectSelectorTest static void toSOQL_When_SystemModeAndChildRelationship_Expect_WellFormedSOQL(){ AccessLevelAccountSelector sel = new AccessLevelAccountSelector(fflib_SObjectSelector.DataAccess.SYSTEM_MODE); - String soql = sel.createSelectAccountWithOpportunitiesSOQL(); + AccessLevelOpportunitySelector innerSelector = new AccessLevelOpportunitySelector(); - String expected = String.format('SELECT name, id, annualrevenue, accountnumber, (currencyisocode, )?\\(SELECT name, id, amount, closedate(, currencyisocode)? FROM Opportunities ORDER BY {0} ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', - new List{sel.getOrderBy()}); + String soql = sel.createSelectAccountWithOpportunitiesSOQL(); + + String expected = String.format( + 'SELECT name, id, annualrevenue, accountnumber, (currencyisocode, )?\\(SELECT name, id, amount, closedate(, currencyisocode)? FROM Opportunities ORDER BY {0} ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY {1} ASC NULLS FIRST ', + new List{ innerSelector.getOrderBy(), sel.getOrderBy() } + ); Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(),'Expected: ' + expected + ' Actual:' + soql); From 5954acc6c5abc6d7898406e2efc07e22e4b1801e Mon Sep 17 00:00:00 2001 From: nwcm <111259588+nwcm@users.noreply.github.com> Date: Thu, 20 Nov 2025 14:27:31 +1100 Subject: [PATCH 2/2] fix: inner order test for encryption support --- .../classes/fflib_SObjectSelectorTest.cls | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 989b4b5f28..a15d1270c4 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -833,16 +833,18 @@ private with sharing class fflib_SObjectSelectorTest TaskSelector tSel = new TaskSelector(); fflib_QueryFactory tQF = tSel.addQueryFactorySubselect(listEmailQF); - String expected - = 'SELECT name, id, annualrevenue, accountnumber, ' - + '(SELECT id, contractnumber, ' - + '(SELECT name, id, amount, closedate, ' - + '(SELECT id, name, ' - + '(SELECT id, subject FROM Tasks ORDER BY Subject ASC NULLS FIRST ) ' - + 'FROM ListEmails ORDER BY Name ASC NULLS FIRST ) ' - + 'FROM Opportunities ORDER BY Name ASC NULLS FIRST ) ' - + 'FROM Contracts ORDER BY ContractNumber ASC NULLS FIRST ) ' - + 'FROM Account WITH USER_MODE ORDER BY Name ASC NULLS FIRST '; + String expected = String.format( + 'SELECT name, id, annualrevenue, accountnumber, ' + + '(SELECT id, contractnumber, ' + + '(SELECT name, id, amount, closedate, ' + + '(SELECT id, name, ' + + '(SELECT id, subject FROM Tasks ORDER BY {0} ASC NULLS FIRST ) ' + + 'FROM ListEmails ORDER BY {1} ASC NULLS FIRST ) ' + + 'FROM Opportunities ORDER BY {2} ASC NULLS FIRST ) ' + + 'FROM Contracts ORDER BY {3} ASC NULLS FIRST ) ' + + 'FROM Account WITH USER_MODE ORDER BY {4} ASC NULLS FIRST ', + new List{ tSel.getOrderBy(), listEmailSel.getOrderBy(), oppSel.getOrderBy(), cSel.getOrderBy(), aSel.getOrderBy() } + ); Assert.areEqual(expected,aQF.toSOQL()); }