MemoizedSystemConfigLoader example


    public function testMemoizationWithSalesChannelIdWorks(): void
    {
        $expectedConfig = ['abc' => ['config' => ['foo' => 'abc']]];

        $mock = $this->createMock(AbstractSystemConfigLoader::class);
        $mock->expects(static::once())
            ->method('load')
            ->willReturn($expectedConfig);

        $configStore = new MemoizedSystemConfigStore();
        $service = new MemoizedSystemConfigLoader($mock$configStore);

        $config = $service->load(TestDefaults::SALES_CHANNEL);
        static::assertSame($expectedConfig$config);

        // Ensure a second call does not call the load method and returns the same result.         $config = $service->load(TestDefaults::SALES_CHANNEL);
        static::assertSame($expectedConfig$config);
    }

    public function testMemoizationWithoutSalesChannelIdWorks(): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.