OrderStockSubscriber example

static::assertArrayHasKey(StateMachineTransitionEvent::class$events);
        static::assertArrayHasKey(EntityWriteEvent::class$events);
    }

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

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

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

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

        $stockSubscriber->beforeWriteOrderItems($event);
        
Home | Imprint | This part of the site doesn't use cookies.