createRuleScope example


#[Package('buyers-experience')] class SalesChannelRuleTest extends TestCase
{
    /** * @dataProvider provideTestData * * @param list<string> $salesChannelIds */
    public function testMatchesWithCorrectSalesChannel(string $operator, string $currentSalesChannel, ?array $salesChannelIds, bool $expected): void
    {
        $ruleScope = $this->createRuleScope($currentSalesChannel);

        $salesChannelRule = new SalesChannelRule($operator$salesChannelIds);

        static::assertSame($expected$salesChannelRule->match($ruleScope));
    }

    public static function provideTestData(): \Generator
    {
        yield 'matches with correct sales channel' => [
            Rule::OPERATOR_EQ,
            Uuid::fromStringToHex('test'),
            [
Home | Imprint | This part of the site doesn't use cookies.