From 9c70272230165274e6229b3a2a6fd3a53ed35209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Thu, 31 Dec 2020 13:04:16 +0100 Subject: [PATCH] EZP-31309: Exposed site access persistence value generation (#139) --- .../Core/Limitation/SiteAccessLimitationType.php | 6 +----- .../Limitation/Tests/SiteAccessLimitationTypeTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/eZ/Publish/Core/Limitation/SiteAccessLimitationType.php b/eZ/Publish/Core/Limitation/SiteAccessLimitationType.php index 6a08644310..7c616a7b09 100644 --- a/eZ/Publish/Core/Limitation/SiteAccessLimitationType.php +++ b/eZ/Publish/Core/Limitation/SiteAccessLimitationType.php @@ -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)); } diff --git a/eZ/Publish/Core/Limitation/Tests/SiteAccessLimitationTypeTest.php b/eZ/Publish/Core/Limitation/Tests/SiteAccessLimitationTypeTest.php index 4f6b152d39..30af420f04 100644 --- a/eZ/Publish/Core/Limitation/Tests/SiteAccessLimitationTypeTest.php +++ b/eZ/Publish/Core/Limitation/Tests/SiteAccessLimitationTypeTest.php @@ -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')); + } }