apex-enterprise-patterns / fflib-apex-common

Common Apex Library supporting Apex Enterprise Patterns and much more!
BSD 3-Clause "New" or "Revised" License
899 stars 514 forks source link

Deploy button doesn't deploy because there are test failures #439

Closed martingaleh closed 1 year ago

martingaleh commented 1 year ago

Describe the bug When I press deploy to production, the deployment fails because the test fails

To Reproduce

(Please provide a public github repo with a full SFDX project that demonstrates the problem. If the repro case can be followed with a single example Apex class against a scratch org with just the fflib-apex-common and fflib-apex-mocks project deployed into it, you don't need to provide a github repo)

Steps to reproduce the behavior:

  1. Create a scratch org as follows....
  2. Run the following Anonymous Apex....
  3. See error

n/a. I"m not running the code, I'm pressing the deploy button

Expected behavior A clear and concise description of what you expected to happen.

I expect the deploy button to deploy the project. Mocks worked

Screenshots and text of error observed If applicable, add screenshots to help explain your problem. Also, paste the text of the raw error into the issue as well so that it can be found by others via search.

image

`Deployment CompleteTest failure, method: fflib_SObjectSelectorTest.toSOQL_When_PolymorphicSelect_Expect_RelatedType -- fflib_QueryFactory.InvalidFieldException: Invalid field 'CurrencyIsoCode' for object 'Group' stack Class.fflib_QueryFactory.getFieldPath: line 146, column 1 Class.fflib_QueryFactory.getFieldPath: line 156, column 1 Class.fflib_QueryFactory.selectStringField: line 285, column 1 Class.fflib_QueryFactory: line 273, column 1 Class.fflib_QueryFactory.selectField: line 245, column 1 Class.fflib_SObjectSelector.configureQueryFactoryFields: line 436, column 1 Class.fflib_SObjectSelectorTest.toSOQL_When_PolymorphicSelect_Expect_RelatedType: line 661, column 1

Test failure, method: fflib_SObjectSelectorTest.toSOQL_When_SystemModeAndChildRelationship_Expect_WellFormedSOQL -- System.AssertException: Assertion Failed: Expected: SELECT name, id, annualrevenue, accountnumber,(.*)(SELECT name, id, amount, closedate FROM Opportunities ORDER BY Name ASC NULLS FIRST ) FROM Account WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST Actual:SELECT name, id, annualrevenue, accountnumber, currencyisocode, (SELECT name, id, amount, closedate, currencyisocode FROM Opportunities ORDER BY Name ASC NULLS FIRST ) FROM Account WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST stack Class.fflib_SObjectSelectorTest.toSOQL_When_SystemModeAndChildRelationship_Expect_WellFormedSOQL: line 461, column 1

Test failure, method: fflib_SObjectSelectorTest.toSOQL_When_SystemModeAndParentRelationshipAndDuplicateFields_Expect_WellFormedSOQL -- System.AssertException: Assertion Failed: Expected: SELECT name, id, amount, closedate, account.name, account.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST Actual:SELECT name, id, amount, closedate, currencyisocode, account.name, account.billingpostalcode FROM Opportunity WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST stack Class.fflib_SObjectSelectorTest.toSOQL_When_SystemModeAndParentRelationshipAndDuplicateFields_Expect_WellFormedSOQL: line 449, column 1

Test failure, method: fflib_SObjectSelectorTest.toSOQL_When_SystemModePolymorphicSelect_Expect_RelatedType -- System.AssertException: Assertion Failed: Expected: SELECT id, status, lead.ownerid, lead.id, lead.owner.userroleid, lead.owner.id, CurrencyIsoCode FROM CampaignMember WITH SYSTEM_MODE ORDER BY CreatedDate ASC NULLS FIRST , Actual: SELECT id, status, currencyisocode, lead.ownerid, lead.id, lead.currencyisocode, lead.owner.userroleid, lead.owner.id, lead.owner.currencyisocode FROM CampaignMember WITH SYSTEM_MODE ORDER BY CreatedDate ASC NULLS FIRST stack Class.fflib_SObjectSelectorTest.toSOQL_When_SystemModePolymorphicSelect_Expect_RelatedType: line 703, column 1 `

Version Did you try to reproduce the problem against the latest fflib-apex-common code? I don't know the version. https://githubsfdeploy.herokuapp.com/app/githubdeploy/apex-enterprise-patterns/fflib-apex-common and here's the salient info image

daveespo commented 1 year ago

Duplicate of #437 for which there is an open PR to resolve the issue #438