From 324ca46f18af24b29b1986fc4480c1c149d219c2 Mon Sep 17 00:00:00 2001 From: Simon Gadient Date: Thu, 12 Jan 2023 10:13:45 +0100 Subject: [PATCH] TASK: support custom loader --- Classes/Context.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Context.php b/Classes/Context.php index 159f7c6..28c45d0 100644 --- a/Classes/Context.php +++ b/Classes/Context.php @@ -45,7 +45,7 @@ class Context * @param ObjectManagerInterface $objectManager Object manager for constructor injection * @param bool $persistenceEnabled Flag to enable persistence of objects */ - public function __construct(ObjectManagerInterface $objectManager, bool $persistenceEnabled = false) + public function __construct(ObjectManagerInterface $objectManager, bool $persistenceEnabled = false, ?NativeLoader $loader = null) { $this->persistenceEnabled = $persistenceEnabled; @@ -55,7 +55,7 @@ public function __construct(ObjectManagerInterface $objectManager, bool $persist $this->settings = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Swisscom.AliceConnector'); - $this->loader = new NativeLoader(); + $this->loader = $loader ?: new NativeLoader(); $this->faker = $this->loader->getFakerGenerator(); foreach ($this->settings['fakerProviders'] as $fakerProviderSetting) {