public function onContentCacheClear(ContentCacheClearEvent $event) { $contentInfo = $event->getContentInfo(); foreach ($this->locationService->loadLocations($contentInfo) as $location) { $event->addLocationToClear($location); } }
public function testOnContentCacheClear() { $contentId = 123; $contentInfo = new ContentInfo(['id' => $contentId]); $event = new ContentCacheClearEvent($contentInfo); $locations = [new Location(), new Location(), new Location(), new Location()]; $this->locationService->expects($this->once())->method('loadLocations')->with($contentInfo)->will($this->returnValue($locations)); $this->listener->onContentCacheClear($event); $this->assertSame($locations, $event->getLocationsToClear()); }