Extensions - Reset container+dispatcher after toggling extensions
This fixes an issue in E2E testing. Suppose you have a test like this:
1: function testFoo() {
2: civicrm_api3('Extension', 'enable', ['key' => 'foo']);
3: assertTrue(Civi::container()->has('foo_service'));
4: civicrm_api3('Extension', 'disable', ['key' => 'foo']);
5: assertFalse(Civi::container()->has('foo_service'));
6: }
The assertion at line 5 would fail -- because the 'disable' step did not
fully reset the `Container`. This problem could then apply to anything that
lives in the container, such as the dispatcher and its listeners.
There is test-coverage in `mixin/scan-classes@1/example` and
`E2E_Shimmy_LifecycleTest::testLifecycleWithLocalFunctions()`.
The test doesn't specifically mention `Container`, but it focuses on one
important service (*the dispatcher*) that lives in the container.
I'm not sure if the problem affected headless tests.