eZ\Publish\Core\Repository\Tests\Service\Integration\TrashBase::testRecoverToDifferentLocation PHP Method

testRecoverToDifferentLocation() public method

Test recovering a location from trash to different location.
    public function testRecoverToDifferentLocation()
    {
        // @todo: remove creating test locations when field types are fully functional
        // Create test locations
        $deleteLocationId = $this->createTestContentLocation(5)->contentInfo->mainLocationId;
        $recoverLocationId = $this->createTestContentLocation(5)->contentInfo->mainLocationId;
        /* BEGIN: Use Case */
        $locationService = $this->repository->getLocationService();
        $trashService = $this->repository->getTrashService();
        $location = $locationService->loadLocation($deleteLocationId);
        $trashItem = $trashService->trash($location);
        $newParentLocation = $locationService->loadLocation($recoverLocationId);
        $recoveredLocation = $trashService->recover($trashItem, $newParentLocation);
        /* END: Use Case */
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\Location', $recoveredLocation);
        self::assertSameClassPropertiesCorrect(array('priority', 'hidden', 'invisible', 'remoteId', 'depth', 'sortField', 'sortOrder'), $location, $recoveredLocation, array('depth'));
        $parentLocation = $locationService->loadLocation($recoveredLocation->parentLocationId);
        $newPathString = $parentLocation->pathString . $recoveredLocation->id . '/';
        self::assertEquals($parentLocation->depth + 1, $recoveredLocation->depth);
        self::assertEquals($newPathString, $recoveredLocation->pathString);
        self::assertGreaterThan(0, $recoveredLocation->id);
        self::assertEquals($newParentLocation->id, $recoveredLocation->parentLocationId);
    }