Skip to content
Permalink
Browse files

EZP-30300: Fixed "Undefined offset: 0" notice when LocationService::l…

…oadLocationList is invoked with id of the root location (#2587)
  • Loading branch information...
adamwojs authored and lserwatka committed Mar 26, 2019
1 parent 800c7f3 commit 03145913570ca53991f1284845c06f1698c7759e
@@ -613,6 +613,26 @@ public function testLoadLocationListPrioritizedLanguagesFallbackAndAlwaysAvailab
self::assertEquals(5, $locations[5]->id);
}
/**
* Test for the loadLocationList() method.
*
* @covers \eZ\Publish\API\Repository\LocationService::loadLocationList
*/
public function testLoadLocationListWithRootLocationId()
{
$repository = $this->getRepository();
// 1 is the ID of an root location
$locationService = $repository->getLocationService();
$locations = $locationService->loadLocationList([1]);
self::assertInternalType('iterable', $locations);
self::assertCount(1, $locations);
self::assertEquals([1], array_keys($locations));
self::assertInstanceOf(Location::class, $locations[1]);
self::assertEquals(1, $locations[1]->id);
}
/**
* Test for the loadLocationByRemoteId() method.
*
@@ -247,8 +247,8 @@ public function loadLocationList(array $locationIds, array $prioritizedLanguages
foreach ($spiLocations as $spiLocation) {
$location = $this->domainMapper->buildLocationWithContent(
$spiLocation,
$contentProxyList[$spiLocation->contentId],
$spiContentInfoList[$spiLocation->contentId]
$contentProxyList[$spiLocation->contentId] ?? null,
$spiContentInfoList[$spiLocation->contentId] ?? null
);
if ($permissionResolver->canUser('content', 'read', $location->getContentInfo(), [$location])) {

0 comments on commit 0314591

Please sign in to comment.
You can’t perform that action at this time.