Does anyone have any advice for how to unit test a Symfony2 CompilerPassInterface::process() instance?
In particular, the ones I want to test generally deal with tagged items, adding method calls to a "manager" service.
If you want to test it in isolation, you'll have to mock the ContainerBuilder, and mock any service definition it returns.
That's usually quite annoying though. So I would tend to write an integration test instead. And in fact, that's what most of the compiler pass tests of symfony core do as well.
You would:
ContainerBuilder$pass->process($container);For an example of this, take a look at the RemoveUnusedDefinitionsPassTest.