aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front/controller/visitor/FrontControllerMockHelper.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/front/controller/visitor/FrontControllerMockHelper.php')
-rw-r--r--tests/front/controller/visitor/FrontControllerMockHelper.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/front/controller/visitor/FrontControllerMockHelper.php b/tests/front/controller/visitor/FrontControllerMockHelper.php
index d16b6949..fecd0c82 100644
--- a/tests/front/controller/visitor/FrontControllerMockHelper.php
+++ b/tests/front/controller/visitor/FrontControllerMockHelper.php
@@ -42,7 +42,7 @@ trait FrontControllerMockHelper
42 // Config 42 // Config
43 $this->container->conf = $this->createMock(ConfigManager::class); 43 $this->container->conf = $this->createMock(ConfigManager::class);
44 $this->container->conf->method('get')->willReturnCallback(function (string $parameter, $default) { 44 $this->container->conf->method('get')->willReturnCallback(function (string $parameter, $default) {
45 return $default; 45 return $default === null ? $parameter : $default;
46 }); 46 });
47 47
48 // PageBuilder 48 // PageBuilder
@@ -101,6 +101,14 @@ trait FrontControllerMockHelper
101 ; 101 ;
102 } 102 }
103 103
104 protected static function generateString(int $length): string
105 {
106 // bin2hex(random_bytes) generates string twice as long as given parameter
107 $length = (int) ceil($length / 2);
108
109 return bin2hex(random_bytes($length));
110 }
111
104 /** 112 /**
105 * Force to be used in PHPUnit context. 113 * Force to be used in PHPUnit context.
106 */ 114 */