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

testCreateLocation() public method

Test creating a location.
public testCreateLocation ( )
    public function testCreateLocation()
    {
        $locationService = $this->repository->getLocationService();
        $contentService = $this->repository->getContentService();
        $parentLocation = $locationService->loadLocation(44);
        $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocation->id);
        $locationCreateStruct->priority = 42;
        $locationCreateStruct->remoteId = 'new-remote-id';
        $locationCreateStruct->hidden = true;
        $locationCreateStruct->sortField = Location::SORT_FIELD_DEPTH;
        $locationCreateStruct->sortOrder = Location::SORT_ORDER_DESC;
        $contentInfo = $contentService->loadContentInfo(12);
        $createdLocation = $locationService->createLocation($contentInfo, $locationCreateStruct);
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\Location', $createdLocation);
        self::assertGreaterThan(0, $createdLocation->id);
        $createdPath = $parentLocation->path;
        $createdPath[] = $createdLocation->id;
        $this->assertPropertiesCorrect(array('priority' => $locationCreateStruct->priority, 'hidden' => $locationCreateStruct->hidden, 'invisible' => $locationCreateStruct->hidden, 'remoteId' => $locationCreateStruct->remoteId, 'parentLocationId' => $locationCreateStruct->parentLocationId, 'pathString' => $parentLocation->pathString . $createdLocation->id . '/', 'path' => $createdPath, 'depth' => $parentLocation->depth + 1, 'sortField' => $locationCreateStruct->sortField, 'sortOrder' => $locationCreateStruct->sortOrder), $createdLocation);
        self::assertEquals($contentInfo->id, $createdLocation->getContentInfo()->id);
    }