pluginPostActivate example

public function testSkipPostCompile(): void
    {
        $context = Context::createDefaultContext();
        $context->addState(PluginLifecycleService::STATE_SKIP_ASSET_BUILDING);
        $activateContextMock = $this->createMock(ActivateContext::class);
        $activateContextMock->expects(static::once())->method('getContext')->willReturn($context);
        $eventMock = $this->createMock(PluginPostActivateEvent::class);
        $eventMock->expects(static::once())->method('getContext')->willReturn($activateContextMock);
        $eventMock->expects(static::never())->method('getPlugin');

        $this->pluginSubscriber->pluginPostActivate($eventMock);
    }

    public function testPluginPostActivate(): void
    {
        $pluginMock = new PluginEntity();
        $pluginMock->setPath('');
        $pluginMock->setBaseClass(FakePlugin::class);
        $eventMock = $this->createMock(PluginPostActivateEvent::class);
        $eventMock->expects(static::exactly(2))->method('getPlugin')->willReturn($pluginMock);
        $this->pluginSubscriber->pluginPostActivate($eventMock);
    }

    
$context,
        );

        $subscriber = new PluginLifecycleSubscriber(
            $storefrontPluginRegistry,
            __DIR__,
            $pluginConfigurationFactory,
            $handler,
            $this->createMock(ThemeLifecycleService::class)
        );

        $subscriber->pluginPostActivate($event);
    }

    public function testAddsThePluginStorefrontConfigurationToConfigurationCollectionIfItWasNotAddedAlready(): void
    {
        $context = Context::createDefaultContext();
        $event = new PluginPostActivateEvent(
            $this->getPlugin(),
            new ActivateContext(
                $this->createMock(Plugin::class),
                $context,
                '6.1.0',
                
Home | Imprint | This part of the site doesn't use cookies.