eZ\Publish\Core\MVC\Symfony\Cache\Tests\Http\EventListener\ParentLocationsListenerTest::testOnContentCacheClear PHP Method

testOnContentCacheClear() public method

    public function testOnContentCacheClear()
    {
        $contentId = 123;
        $contentInfo = new ContentInfo(['id' => $contentId]);
        $event = new ContentCacheClearEvent($contentInfo);
        $parentLocationId1 = 456;
        $parentLocationId2 = 789;
        $parentLocationId3 = 234;
        $parentLocationId4 = 567;
        $locations = [new Location(['parentLocationId' => $parentLocationId1]), new Location(['parentLocationId' => $parentLocationId2]), new Location(['parentLocationId' => $parentLocationId3]), new Location(['parentLocationId' => $parentLocationId4])];
        $this->locationService->expects($this->once())->method('loadLocations')->with($contentInfo)->will($this->returnValue($locations));
        $parentLocation1 = new Location(['id' => $parentLocationId1]);
        $parentLocation2 = new Location(['id' => $parentLocationId2]);
        $parentLocation3 = new Location(['id' => $parentLocationId3]);
        $parentLocation4 = new Location(['id' => $parentLocationId4]);
        $parentLocations = [$parentLocation1, $parentLocation2, $parentLocation3, $parentLocation4];
        $this->locationService->expects($this->exactly(count($parentLocations)))->method('loadLocation')->will($this->returnValueMap([[$parentLocationId1, $parentLocation1], [$parentLocationId2, $parentLocation2], [$parentLocationId3, $parentLocation3], [$parentLocationId4, $parentLocation4]]));
        $this->listener->onContentCacheClear($event);
        $this->assertSame($parentLocations, $event->getLocationsToClear());
    }