SalesChannelTestHook example


    public function testFacade(array $criteria, string $method, IdsCollection $ids, callable $expectation): void
    {
        $this->ids = $ids;
        $this->createProducts();

        $facade = $this->factory->factory(
            new SalesChannelTestHook('test', $this->context),
            new Script('test', '', new \DateTimeImmutable())
        );

        $result = $facade->$method('product', $criteria); /* @phpstan-ignore-line */

        $expectation($result);
    }

    /** * @return array<string, array<int, mixed>> */
    
'simpleGet' => [
                new TestHook('test', Context::createDefaultContext()),
                null,
                'generic',
            ],
            'salesChannelSpecificGet' => [
                new TestHook('test', Context::createDefaultContext()),
                TestDefaults::SALES_CHANNEL,
                'specific',
            ],
            'itUsesSalesChannelFromSalesChannelContextPerDefault' => [
                new SalesChannelTestHook('test', $salesChannelContext),
                null,
                'specific',
            ],
            'overrideForSalesChannelContext' => [
                new SalesChannelTestHook('test', $salesChannelContext),
                Uuid::randomHex(), // as the value for this salesChannel does not exist it falls back to the generic one                 'generic',
            ],
        ];
    }

    
Home | Imprint | This part of the site doesn't use cookies.