invalidateDetailRoute example


                $this->tags = array_values($event->getKeys());
            }
        };

        $eventDispatcher->addListener(InvalidateCacheEvent::class$listener);

        foreach ($scenarios as $scenario) {
            /** @var list<string> $productsIds */
            $productsIds = array_map(fn (string $product) => $this->ids->get($product)$scenario['invalidate']);

            $this->subscriber->invalidateDetailRoute(new ProductNoLongerAvailableEvent(
                $productsIds,
                Context::createDefaultContext()
            ));

            static::assertSame(
                array_map(fn (string $product) => 'product-detail-route-' . $this->ids->get($product)$scenario['expected']),
                $listener->tags
            );
        }
    }

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