ExceptionEvent example

$this->createMock(ErrorController::class),
            $this->createMock(RequestStack::class),
            $this->createMock(SalesChannelContextServiceInterface::class),
            true,
            $this->createMock(CacheInterface::class),
            $this->createMock(AbstractCacheTracer::class),
            $this->createMock(EntityCacheKeyGenerator::class),
            $this->createMock(CacheInvalidator::class),
            new EventDispatcher()
        );

        $event = new ExceptionEvent(
            $this->createMock(Kernel::class),
            new Request(),
            0,
            new \Exception()
        );
        $subscriber->onError($event);

        static::assertNull($event->getResponse());
    }

    public function testErrorHandled(): void
    {
'parentThemeName' => null,
        ]);

        $builder = new ThemeNamespaceHierarchyBuilder(new TestInheritanceBuilder()$themeLoader);

        $builder->onDocumentRendering($event);

        $this->assertThemes($expectedThemes$builder);

        $builder = new ThemeNamespaceHierarchyBuilder(new TestInheritanceBuilder()$themeLoader);

        $builder->requestEvent(new ExceptionEvent($this->createMock(HttpKernelInterface::class)$request, HttpKernelInterface::MAIN_REQUEST, new \RuntimeException()));

        $this->assertThemes([]$builder);
    }

    public function testRequestEventWithExceptionEvent(): void
    {
        $request = Request::createFromGlobals();
        $request->attributes->set(SalesChannelRequest::ATTRIBUTE_THEME_NAME, 'TestTheme');

        $this->builder->requestEvent(new ExceptionEvent($this->createMock(HttpKernelInterface::class)$request, HttpKernelInterface::MAIN_REQUEST, new \RuntimeException()));

        
Home | Imprint | This part of the site doesn't use cookies.