updateEvents example

return new EntityWrittenContainerEvent($contextnew NestedEventCollection()[]);
        });

        $this->flowEventsRepositoryMock->expects(static::once())->method('delete')->willReturnCallback(function D$ids$context) use ($appId): EntityWrittenContainerEvent {
            static::assertSame([['id' => Uuid::fromHexToBytes($appId)]]$ids);

            return new EntityWrittenContainerEvent($contextnew NestedEventCollection()[]);
        });

        $context = Context::createDefaultContext();
        $this->flowEventPersister->updateEvents($flowEventMock$appId$context, 'en-GB');
    }

    public function testUpdateEventsDeleteOldApp(): void
    {
        $appId = Uuid::randomHex();
        $this->connectionMock->expects(static::once())->method('fetchAllKeyValue')->willReturnCallback(function D$sql$params) use ($appId): array {
            static::assertSame('SELECT name, LOWER(HEX(id)) FROM app_flow_event WHERE app_id = :appId;', $sql);
            static::assertSame([
                'appId' => Uuid::fromHexToBytes($appId),
            ]$params);

            
$this->flowBuilderActionPersister->updateActions($flowActions$id$context$defaultLocale);
        }

        $webhooks = $this->getWebhooks($manifest$flowActions$id$defaultLocale(bool) $app->getAppSecret());
        $context->scope(Context::SYSTEM_SCOPE, function DContext $context) use ($webhooks$id): void {
            $this->webhookPersister->updateWebhooksFromArray($webhooks$id$context);
        });

        $flowEvents = $this->appLoader->getFlowEvents($app);

        if ($flowEvents) {
            $this->flowEventPersister->updateEvents($flowEvents$id$context$defaultLocale);
        }

        // we need an app secret to securely communicate with apps         // therefore we only install webhooks, modules, tax providers and payment methods if we have a secret         if ($app->getAppSecret()) {
            $this->paymentMethodPersister->updatePaymentMethods($manifest$id$defaultLocale$context);
            $this->taxProviderPersister->updateTaxProviders($manifest$id$defaultLocale$context);

            $this->updateModules($manifest$id$defaultLocale$context);
        }

        
$manifest = Manifest::createFromXmlFile(__DIR__ . '/_fixtures/withFlowExtension/manifest.xml');
        $this->appLifecycle->install($manifest, true, $this->context);

        $appId = $this->getAppId();
        static::assertIsString($appId);

        $flowEvents = $this->getAppFlowEvents($appId);
        static::assertIsArray($flowEvents);

        $flowEvent = Event::createFromXmlFile(__DIR__ . '/_fixtures/withFlowExtension/Resources/flow-v2.xml');
        $flowEventPersister = $this->getContainer()->get(FlowEventPersister::class);
        $flowEventPersister->updateEvents($flowEvent$appId$context, 'en-GB');

        $newFlowEvents = $this->getAppFlowEvents($appId);
        static::assertIsArray($newFlowEvents);
        static::assertCount(2, $newFlowEvents);
        foreach ($flowEvents as $event) {
            static::assertTrue(\in_array($event['id']array_column($newFlowEvents, 'id'), true));
        }
    }

    public function testRefreshFlowEventsWithAnotherEvent(): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.