Testing Symfony Services
For integration tests of symfony services in context of their configuration in container, there are multiple ways for retrieving them directly from the symfony container (regardless if there are public or private).
The symfony default way is described here and can be used in context within Pimcore too.
Currently, we are not using the codeception symfony module though, to reduce test complexity and due to lack of compatibility with symfony 6.
To still have the grab service functionality available, just use the
module and call
grabService as below:
/** @var Pimcore $pimcoreModule */
$pimcoreModule = $this->getModule('\\' . Pimcore::class);
$mailerService = $pimcoreModule->grabService('mailer');