aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front/controller/visitor/FrontControllerMockHelper.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-05-30 14:00:06 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit66063ed1a18d739b1a60bfb163d8656417a4c529 (patch)
tree5af628861a42af1a4bf84f6dcd18a24b80cc3a1c /tests/front/controller/visitor/FrontControllerMockHelper.php
parent465033230da0398426010aa7bd3694735b71c899 (diff)
downloadShaarli-66063ed1a18d739b1a60bfb163d8656417a4c529.tar.gz
Shaarli-66063ed1a18d739b1a60bfb163d8656417a4c529.tar.zst
Shaarli-66063ed1a18d739b1a60bfb163d8656417a4c529.zip
Process configure page through Slim controller
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 */