Skip to content

Commit

Permalink
EZP-31309: Exposed site access persistence value generation (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p committed Dec 31, 2020
1 parent 243cdae commit 9c70272
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 1 addition & 5 deletions eZ/Publish/Core/Limitation/SiteAccessLimitationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ public function __construct(

/**
* Generates the SiteAccess value as CRC32.
*
* @param string $sa
*
* @return string
*/
private function generateSiteAccessValue($sa)
public function generateSiteAccessValue(string $sa): string
{
return sprintf('%u', crc32($sa));
}
Expand Down
10 changes: 10 additions & 0 deletions eZ/Publish/Core/Limitation/Tests/SiteAccessLimitationTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,14 @@ public function testValueSchema(SiteAccessLimitationType $limitationType)
{
self::markTestSkipped('Method valueSchema() is not implemented');
}

/**
* @depends testConstruct
*/
public function testGenerateSiteAccessValue(SiteAccessLimitationType $limitationType): void
{
self::assertSame('341347141', $limitationType->generateSiteAccessValue('ger'));
self::assertSame('2582995467', $limitationType->generateSiteAccessValue('eng'));
self::assertSame('1817462202', $limitationType->generateSiteAccessValue('behat_site'));
}
}

0 comments on commit 9c70272

Please sign in to comment.