We have some tests that use
System.runAs for a
User created like this:
Contact c = ...; Profile p = [ select Id from Profile where UserType = 'CspLitePortal' limit 1 ]; insert u = new User( ProfileId = p.id, ContactId = c.id, ... );
and they have started failing in the last 2 weeks. Seems like a sharing problem, where the test - running as a SA User - inserts rows, but the
System.runAs User can't see them for custom objects and objects like Attachment.
Anyone else having this problem? Summer '19? Or a side effect of Multi-Instance Core and Communities Service Disruption starting May 17, 2019? Workarounds?
with sharing to
without sharing eliminates the problem but is not a change that makes sense for production use.