beforeWriteOrderItems example

$stockSubscriber = new OrderStockSubscriber(
            $this->createMock(Connection::class),
            $stockStorage,
            false
        );

        $event = EntityWriteEvent::create(
            WriteContext::createFromContext($context),
            [],
        );

        $stockSubscriber->beforeWriteOrderItems($event);
        $event->success();
    }

    public function testBeforeWriteOnlyReactsToLiveVersions(): void
    {
        $context = Context::createDefaultContext()->createWithVersionId($this->ids->create('version'));

        $stockStorage = $this->createMock(StockStorage::class);
        $stockStorage->expects(static::never())->method('alter');

        $stockSubscriber = new OrderStockSubscriber(
            
Home | Imprint | This part of the site doesn't use cookies.