eZ\Publish\Core\Repository\Tests\Service\Integration\LocationBase::testLoadLocations PHP Method

testLoadLocations() public method

Test loading locations for content.
public testLoadLocations ( )
    public function testLoadLocations()
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo(12);
        $locationService = $this->repository->getLocationService();
        $locations = $locationService->loadLocations($contentInfo);
        self::assertInternalType('array', $locations);
        self::assertNotEmpty($locations);
        foreach ($locations as $location) {
            self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\Location', $location);
            self::assertEquals($contentInfo->id, $location->getContentInfo()->id);
        }
        $locationsCount = count($locations);
        $locationCreateStruct = $locationService->newLocationCreateStruct(44);
        $locationService->createLocation($contentInfo, $locationCreateStruct);
        $locations = $locationService->loadLocations($contentInfo);
        self::assertInternalType('array', $locations);
        self::assertNotEmpty($locations);
        foreach ($locations as $location) {
            self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\Location', $location);
            self::assertEquals($contentInfo->id, $location->getContentInfo()->id);
        }
        $newLocationsCount = count($locations);
        self::assertEquals($locationsCount + 1, $newLocationsCount);
    }