orderPlaced example

$this->getConnectionMock(),
            $this->dispatcher,
            new StockUpdateFilterProvider([$filter]),
        );

        $event = new CheckoutOrderPlacedEvent(
            Context::createDefaultContext(),
            $this->createOrder(),
            $this->ids->get('sales-channel')
        );

        $stockUpdater->orderPlaced($event);
    }

    public function testStockUpdateFilterOnUpdate(): void
    {
        $ids = \array_values($this->ids->getList(['id1', 'id2']));

        $filter = $this->getStockUpdateFilterMock($ids);

        $stockUpdater = new StockUpdater(
            $this->getConnectionMock(),
            $this->dispatcher,
            
->first();

        static::assertNotNull($order);

        $event = new CheckoutOrderPlacedEvent(
            Context::createDefaultContext(),
            $order,
            Defaults::SALES_CHANNEL_TYPE_STOREFRONT
        );

        $updater = $this->getContainer()->get(PromotionRedemptionUpdater::class);
        $updater->orderPlaced($event);

        $promotions = $connection->fetchAllAssociative(
            'SELECT `id`, `orders_per_customer_count` FROM `promotion` WHERE `id` = :id',
            ['id' => Uuid::fromHexToBytes($voucherA)]
        );

        $expected_json = json_encode([$this->ids->get('customer') => 1], \JSON_THROW_ON_ERROR);
        static::assertIsString($expected_json);

        static::assertCount(1, $promotions);
        static::assertJsonStringEqualsJsonString(
            
Home | Imprint | This part of the site doesn't use cookies.