PluginPostDeactivationFailedEvent example


        } catch (\Throwable $exception) {
            $activateContext = new ActivateContext(
                $pluginBaseClass,
                $shopwareContext,
                $this->shopwareVersion,
                $plugin->getVersion(),
                $this->createMigrationCollection($pluginBaseClass)
            );

            $this->eventDispatcher->dispatch(
                new PluginPostDeactivationFailedEvent(
                    $plugin,
                    $activateContext,
                    $exception
                )
            );

            throw $exception;
        }

        $this->signalWorkerStopInOldCacheDir();

        
/** * @internal * * @covers \Shopware\Core\Framework\Plugin\Event\PluginPostDeactivationFailedEvent */
class PluginPostDeactivationFailedEventTest extends TestCase
{
    public function testEvent(): void
    {
        $activateContext = $this->createMock(ActivateContext::class);
        $exception = new \Exception('failed');
        $event = new PluginPostDeactivationFailedEvent(
            new PluginEntity(),
            $activateContext,
            $exception
        );
        static::assertInstanceOf(PluginLifecycleEvent::class$event);
        static::assertEquals($activateContext$event->getContext());
        static::assertEquals($exception$event->getException());
    }
}
Home | Imprint | This part of the site doesn't use cookies.