3.7 Test Services
If your plugin needs extra services or overrides used only during tests,
add them in tests/TestApplication/config/services_test.php
.
Example:
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return function (ContainerConfigurator $container): void {
$env = $_ENV['APP_ENV'] ?? 'dev';
if (str_starts_with($env, 'test')) {
// Add or override services here, e.g. fake clients, stubs, test configs
}
};
Important:
You must also import this file in config.yaml
.
Last updated
Was this helpful?