Skip to content

Commit

Permalink
EZP-32308: Fixed failing tests due to pgsql randomness in returned re…
Browse files Browse the repository at this point in the history
…sults (#3088)
  • Loading branch information
ViniTou authored Feb 15, 2021
1 parent fe9b584 commit d2d3eee
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions eZ/Publish/API/Repository/Tests/PermissionResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1274,36 +1274,39 @@ public function testLookupLimitationsWithMixedTargets(): void
$roleService->assignRoleToUser($role, $user);
$permissionResolver->setCurrentUserReference($user);

$expected = new LookupLimitationResult(
true,
[],
$actual = $permissionResolver->lookupLimitations(
$module,
$function,
$location->contentInfo,
[
(new VersionBuilder())->translateToAnyLanguageOf(['eng-GB'])->build(),
$location,
],
[Limitation::LANGUAGE]
);

self::assertTrue($actual->hasAccess);
self::assertEmpty($actual->roleLimitations);
self::assertCount(2, $actual->lookupPolicyLimitations);

self::assertTrue(
in_array(
new LookupPolicyLimitations(
$role->getPolicies()[0],
[]
),
$actual->lookupPolicyLimitations
));
self::assertTrue(
in_array(
new LookupPolicyLimitations(
$role->getPolicies()[1],
[
new Limitation\LanguageLimitation(['limitationValues' => ['eng-GB']]),
]
),
]
);

self::assertEquals(
$expected,
$permissionResolver->lookupLimitations(
$module,
$function,
$location->contentInfo,
[
(new VersionBuilder())->translateToAnyLanguageOf(['eng-GB'])->build(),
$location,
],
[Limitation::LANGUAGE]
)
);
$actual->lookupPolicyLimitations
));
}

/**
Expand Down

0 comments on commit d2d3eee

Please sign in to comment.