AppActivatedEvent example



        $this->appRepo->update([['id' => $appId, 'active' => true]]$context);
        $this->templateStateService->activateAppTemplates($appId$context);
        $this->scriptPersister->activateAppScripts($appId$context);
        $this->paymentMethodStateService->activatePaymentMethods($appId$context);
        $this->ruleConditionPersister->activateConditionScripts($appId$context);
        $this->activeAppsLoader->reset();
        // manually set active flag to true, so we don't need to re-fetch the app from DB         $app->setActive(true);

        $event = new AppActivatedEvent($app$context);
        $this->eventDispatcher->dispatch($event);
        $this->scriptExecutor->execute(new AppActivatedHook($event));
    }

    public function deactivateApp(string $appId, Context $context): void
    {
        /** @var AppEntity|null $app */
        $app = $this->appRepo->search(new Criteria([$appId])$context)->first();

        if (!$app) {
            throw AppException::notFound($appId);
        }
use Shopware\Core\Framework\Webhook\AclPrivilegeCollection;

/** * @internal */
class AppActivatedEventTest extends TestCase
{
    public function testGetter(): void
    {
        $app = new AppEntity();
        $context = Context::createDefaultContext();
        $event = new AppActivatedEvent(
            $app,
            $context
        );

        static::assertEquals($app$event->getApp());
        static::assertEquals($context$event->getContext());
        static::assertEquals(AppActivatedEvent::NAME, $event->getName());
        static::assertEquals([]$event->getWebhookPayload());
    }

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