CustomerNewsletterSalesChannelsUpdater example

'last_name' => 'Tran',
                'first_name' => 'Y',
                'newsletter_sales_channel_ids' => $newsletterIds,
            ],
        ]);

        $expectsClosure(
            $connection,
            $newsletterIds ? array_keys(json_decode($newsletterIds, true, 512, \JSON_THROW_ON_ERROR)) : null
        );

        $indexing = new CustomerNewsletterSalesChannelsUpdater($connection);
        $indexing->updateCustomersRecipient([Uuid::randomHex()]);
    }

    public static function dataProvider(): \Generator
    {
        yield 'Email Newsletter Recipient Registered' => [
            'newsletter_sales_channel_ids' => json_encode([Uuid::randomHex() => Uuid::randomHex()], \JSON_THROW_ON_ERROR),
            function DMockObject $connection, ?array $ids): void {
                $connection->expects(static::once())->method('executeStatement')->willReturnCallback(function D$sql$params) use ($ids): void {
                    static::assertSame('UPDATE newsletter_recipient SET email = (:email), first_name = (:firstName), last_name = (:lastName) WHERE id IN (:ids)', $sql);

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