diff --git a/force-app/database/classes/dfflib_DatabaseTest.cls b/force-app/database/classes/dfflib_DatabaseTest.cls index ac95bcb..cc19179 100644 --- a/force-app/database/classes/dfflib_DatabaseTest.cls +++ b/force-app/database/classes/dfflib_DatabaseTest.cls @@ -434,6 +434,7 @@ private with sharing class dfflib_DatabaseTest{ /** * As per Summer'24 (API v61.0), EventBus.publish(SObject event) returns a System.UnexpectedException when attempting to publish an SObject that represents an object that isn’t a platform event. + * EventBus.publishWithAccessLevel(SObject event, AccessLevel accessLevel), introduced in Summer'26 (API v67.0), behaves the same. * Therefore, only standard PlatformEvent or project-specific CustomEvent can be specified (though not being able to rely on) * Hence, covering as much lines as possible and ensuring those parts of code behave as expected */ @@ -920,6 +921,7 @@ private with sharing class dfflib_DatabaseTest{ /** * As per Summer'24 (API v61.0), EventBus.publish(SObject event) returns a System.UnexpectedException when attempting to publish an SObject that represents an object that isn’t a platform event. + * EventBus.publishWithAccessLevel(SObject event, AccessLevel accessLevel), introduced in Summer'26 (API v67.0), behaves the same. * Therefore, only standard PlatformEvent or project-specific CustomEvent can be specified (though not being able to rely on) * Hence, covering as much lines as possible and ensuring those parts of code behave as expected */ @@ -1419,6 +1421,7 @@ private with sharing class dfflib_DatabaseTest{ /** * As per Summer'24 (API v61.0), EventBus.publish(SObject event) returns a System.UnexpectedException when attempting to publish an SObject that represents an object that isn’t a platform event. + * EventBus.publishWithAccessLevel(SObject event, AccessLevel accessLevel), introduced in Summer'26 (API v67.0), behaves the same. * Therefore, only standard PlatformEvent or project-specific CustomEvent can be specified (though not being able to rely on) * Hence, covering as much lines as possible and ensuring those parts of code behave as expected */ @@ -1923,6 +1926,7 @@ private with sharing class dfflib_DatabaseTest{ /** * As per Summer'24 (API v61.0), EventBus.publish(SObject event) returns a System.UnexpectedException when attempting to publish an SObject that represents an object that isn’t a platform event. + * EventBus.publishWithAccessLevel(SObject event, AccessLevel accessLevel), introduced in Summer'26 (API v67.0), behaves the same. * Therefore, only standard PlatformEvent or project-specific CustomEvent can be specified (though not being able to rely on) * Hence, covering as much lines as possible and ensuring those parts of code behave as expected */ diff --git a/force-app/database/classes/dfflib_Database_DMLProxy.cls b/force-app/database/classes/dfflib_Database_DMLProxy.cls index 5bc7061..35b0835 100644 --- a/force-app/database/classes/dfflib_Database_DMLProxy.cls +++ b/force-app/database/classes/dfflib_Database_DMLProxy.cls @@ -77,7 +77,7 @@ public abstract class dfflib_Database_DMLProxy{ if( objList != null && !objList.isEmpty() ){ switch on action{ when dPUB_BEFORE, dPUB_AFTER_SUCCESS, dPUB_AFTER_FAILURE{ - return EventBus.publish( objList ); + return EventBus.publishWithAccessLevel( objList, accessLevel ); } when dEMPTY_RECBIN{ return Database.emptyRecycleBin( objList ); @@ -182,7 +182,7 @@ public abstract class dfflib_Database_DMLProxy{ if( objList != null && !objList.isEmpty() && accessLevel != null ){ switch on action{ when dPUB_BEFORE, dPUB_AFTER_SUCCESS, dPUB_AFTER_FAILURE{ - return EventBus.publish( objList ); + return EventBus.publishWithAccessLevel( objList, accessLevel ); } when dEMPTY_RECBIN{ return Database.emptyRecycleBin( objList ); @@ -287,7 +287,7 @@ public abstract class dfflib_Database_DMLProxy{ if( objList != null && !objList.isEmpty() && accessLevel != null ){ switch on action{ when dPUB_BEFORE, dPUB_AFTER_SUCCESS, dPUB_AFTER_FAILURE{ - return EventBus.publish( objList ); + return EventBus.publishWithAccessLevel( objList, accessLevel ); } when dEMPTY_RECBIN{ return Database.emptyRecycleBin( objList );