Closed adtennant closed 9 years ago
PS. I wish these were global in c2g so I didn't have to have the same classes twice.
I've not yet figured out why the above pull request resolves this issue, but it does. If I figure it out I will comment here.
Yeah, i think as i've said in another comment, talking with @capeterson i think the use of fflib_QueryFactory in the new Selector base class is causing some instability in the tests, since QueryFactory is using Set's / Map's. We need to put some ordering into the fields emitted when the toSQL function is called.
I have an open pull request on our internal git with a fix to make fflib_QueryFactory.toSOQL() deterministic. Once it makes it through code review we'll get it updated here.
Any updates on this? We really want to use the fflib packages but this makes them a risk for every release.
I believe I have fixed this in pull request #33. Because the field collection is backed by a Set, the are returned in an unpredictable order. Since I don't believe there's any particular need to preserve the ordering of the fields in the generated SOQL, I fixed the test assertions to tolerate the fields coming back in any order.
I've now merged PR 33, thanks.
When deploying into a fresh developer edition, all tests pass and everything is hunky dory.
When deploying into an environment which has the followingFinancial Force packages installed (and no other Apex), SObjectSelectorTests fail.
Test Failures
Class fflib_SObjectSelectorTest Method Name testDefaultConfig Pass/Fail Fail Error Message System.AssertException: Assertion Failed: Expected: AccountNumber,AnnualRevenue,Id,Name, Actual: Name,AnnualRevenue,AccountNumber,Id Stack Trace Class.fflib_SObjectSelectorTest.testDefaultConfig: line 185, column 1
Class fflib_SObjectSelectorTest Method Name testGetFieldListString Pass/Fail Fail Error Message System.AssertException: Assertion Failed: Expected: myprefix.AccountNumber,myprefix.AnnualRevenue,myprefix.Id,myprefix.Name, Actual: myprefix.AccountNumber,myprefix.Name,myprefix.Id,myprefix.AnnualRevenue Stack Trace Class.fflib_SObjectSelectorTest.testGetFieldListString: line 46, column 1