FlowFactory example

->method('get')
            ->willReturn($order);

        $orderRepo = $this->createMock(EntityRepository::class);
        $orderRepo->expects(static::once())
            ->method('search')
            ->willReturn($entitySearchResult);

        $awareEvent = new CheckoutOrderPlacedEvent(Context::createDefaultContext()$order, 'asdsad');

        $orderStorer = new OrderStorer($orderRepo$this->createMock(EventDispatcherInterface::class));
        $flowFactory = new FlowFactory([$orderStorer]);

        $flow = $flowFactory->create($awareEvent);
        $flow->setConfig($config);

        $stringTemplateRender = $this->createMock(StringTemplateRenderer::class);
        $stringTemplateRender->expects(static::exactly(6))
            ->method('render')
            ->willReturnOnConsecutiveCalls(
                'Text 1',
                'Text 2',
                'Text 3',
                

class FlowFactoryTest extends TestCase
{
    public function testCreate(): void
    {
        $ids = new TestDataCollection();
        $order = new OrderEntity();
        $order->setId($ids->get('orderId'));

        $awareEvent = new CheckoutOrderPlacedEvent(Context::createDefaultContext(new AdminApiSource('test'))$order, TestDefaults::SALES_CHANNEL);
        $orderStorer = new OrderStorer($this->createMock(EntityRepository::class)$this->createMock(EventDispatcherInterface::class));
        $flowFactory = new FlowFactory([$orderStorer]);
        $flow = $flowFactory->create($awareEvent);

        static::assertEquals($ids->get('orderId')$flow->getStore('orderId'));
        static::assertInstanceOf(SystemSource::class$flow->getContext()->getSource());
        static::assertEquals(Context::SYSTEM_SCOPE, $flow->getContext()->getScope());
    }

    public function testRestore(): void
    {
        $ids = new TestDataCollection();
        $order = new OrderEntity();
        
Home | Imprint | This part of the site doesn't use cookies.