This was originally brought up in #375
The provider in question is [this class](https://github.com/smallrye/smallrye-context-propagation/blob/main/tests/src/main/java/io/smallrye/context/test/EntityManagerProvider.java#L29-L32.
This logic won't work if there is CP involved and Weld is used. It is documented in this part of Weld docs but in short, the way we propagate in CDIContextProvider is that we only ever deactivate contexts, but never invalidate them so all pre destroy and disposer methods are skipped. This is because otherwise we would invoke them multiple times, potentially leading too unexpected states.
For what we test, this doesn't matter but it is showing a state that doesn't work and in real app, the EM would never close.
Therefore, we should:
- Move the
em.close() logic elsewhere. Not sure where, maybe @BeforeDestroyed(RequestScoped.class) and we should check if the bean exists before doing that.
- Also assert that pre-destroy and dispose methods aren't invoked with CP in place