ScriptExecutor example

$salesChannelContext->considerInheritance();
        $hook = new ProductPricingHookExtension($proxies$salesChannelContext$ids);

        // allows easy debugging         $traces = new ScriptTraces();

        $loader = $this->createMock(ScriptLoader::class);
        $loader->method('get')->willReturn([
            new Script('foo', (string) \file_get_contents(__DIR__ . '/_fixtures/pricing-cases/product-pricing.twig')new \DateTimeImmutable()),
        ]);

        $executor = new ScriptExecutor($loadernew NullLogger()$traces$this->getContainer()$this->getContainer()->get('twig.extension.trans'), 'v6.5.0.0');

        $executor->execute($hook);

        static::assertNotEmpty($traces->getTraces());
        static::assertArrayHasKey('product-pricing', $traces->getTraces());
        static::assertEquals(
            [
                'original' => 100.0,
                'changed' => 1.5,
                'plus' => 3.0,
                'minus' => 1.5,
                
Home | Imprint | This part of the site doesn't use cookies.