The "new" config storage transformation API which was added to Drupal 8.8
transforms the storage before importing and exporting via the event system.
This is a very different API from Config Filter 1.x but they work together.
This test trait aims to provide methods to guide developers writing tests
that work independently of whether the module uses Config Filter plugins or
the new core events. You do this by comparing what you expect to be imported
or exported.
Drupal core <8.8 with config filter:
export:
[active] ----------------------------------------> [filter wrapping [sync]]
import:
[filter wrapping [sync]] ----------------------------------------> [active]
Drupal core >=8.8:
export:
[active] ---------------> [export transformation] -----------------> [sync]
import:
[sync] -----------------> [import transformation] ---------------> [active]
The test for exporting should set up the active store by saving config and
what is expected to be exported and then compare the export storage with it.
The test for importing should set up the sync store by writing files (or by
saving arrays to the FileStorage) and then comparing the expectations with
the import storage.
Tests using this trait will work with Config Filter 1.x and 2.x and they will
also work when using the core api directly provided the module has the same
behaviour with the event listener as with the config filter plugin.
Check out the example in Config Filter or the tests of Config Split.