ProductSuggestRouteResponse example

$result = $this->productListingLoader->load($criteria$context);

        $result = ProductListingResult::createFrom($result);

        $this->processor->process($request$result$context);

        $this->eventDispatcher->dispatch(
            new ProductSuggestResultEvent($request$result$context),
            ProductEvents::PRODUCT_SUGGEST_RESULT
        );

        return new ProductSuggestRouteResponse($result);
    }
}
public function testLoadWithEnabledCacheWillReturnDataFromCache(): void
    {
        $this->decorated
            ->expects(static::never())
            ->method('load');
        $this->cache
            ->expects(static::once())
            ->method('get')
            ->willReturn(
                CacheValueCompressor::compress(
                    new ProductSuggestRouteResponse(new ProductEntity())
                )
            );
        $this->eventDispatcher->addListener(
            ProductSuggestRouteCacheKeyEvent::class,
            fn (ProductSuggestRouteCacheKeyEvent $event) => $event
        );

        $this->cachedRout->load(new Request()$this->context, new Criteria());
    }
}
Home | Imprint | This part of the site doesn't use cookies.