$configStore =
new MemoizedSystemConfigStore();
$service =
new MemoizedSystemConfigLoader($mock,
$configStore);
$config =
$service->
load(TestDefaults::SALES_CHANNEL
);
static::
assertSame($expectedConfig,
$config);
$dispatcher =
new EventDispatcher();
$dispatcher->
addSubscriber($configStore);
// Dispatching the event resets the memoization and ensures load is called a second time.
$dispatcher->
dispatch(new SystemConfigChangedEvent('abc.config.foo', 'none', TestDefaults::SALES_CHANNEL
));
// The load method is now called a second time as memoization has been reset for the sales channel.
$config =
$service->
load(TestDefaults::SALES_CHANNEL
);
static::
assertSame($expectedConfig,
$config);
} public function testMemoizationResetsOnValueChangeEventWithoutSalesChannelId(): void
{ $expectedConfig =
['abc' =>
['config' =>
['foo' => 'abc'
]]];
$mock =
$this->
createMock(AbstractSystemConfigLoader::
class);