Skip to content

Commit

Permalink
EZP-32401: Added Location Limitation integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 committed Mar 25, 2021
1 parent b76bb25 commit 54513ac
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace eZ\Publish\API\Repository\Tests\Limitation\PermissionResolver;

use eZ\Publish\API\Repository\Repository;
use eZ\Publish\API\Repository\Values\User\Limitation\LocationLimitation;
use eZ\Publish\SPI\Limitation\Target\Version;

Expand Down Expand Up @@ -62,4 +63,35 @@ public function testCanUserEditContent(array $limitations, bool $expectedResult)
[$location, new Version(['allLanguageCodesList' => 'eng-GB'])]
);
}

/**
* @dataProvider providerForCanUserEditOrPublishContent
*
* @throws \eZ\Publish\API\Repository\Exceptions\ForbiddenException
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
*/
public function testCanUserReadTrashedContent(array $limitations, bool $expectedResult): void
{
$repository = $this->getRepository();
$locationService = $repository->getLocationService();

$location = $locationService->loadLocation(2);

$this->loginAsEditorUserWithLimitations('content', 'read', $limitations);

$trashItem = $repository->sudo(
function (Repository $repository) use ($location) {
return $repository->getTrashService()->trash($location);
}
);

$this->assertCanUser(
$expectedResult,
'content',
'read',
$limitations,
$trashItem->contentInfo
);
}
}

0 comments on commit 54513ac

Please sign in to comment.