]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/front/controller/visitor/FrontControllerMockHelper.php
Process configure page through Slim controller
[github/shaarli/Shaarli.git] / tests / front / controller / visitor / FrontControllerMockHelper.php
index d16b6949c21d3f5611399feff93bc8e78f74193f..fecd0c82ffde465c81fcd8eca65ffd76953d0d51 100644 (file)
@@ -42,7 +42,7 @@ trait FrontControllerMockHelper
         // Config
         $this->container->conf = $this->createMock(ConfigManager::class);
         $this->container->conf->method('get')->willReturnCallback(function (string $parameter, $default) {
-            return $default;
+            return $default === null ? $parameter : $default;
         });
 
         // PageBuilder
@@ -101,6 +101,14 @@ trait FrontControllerMockHelper
         ;
     }
 
+    protected static function generateString(int $length): string
+    {
+        // bin2hex(random_bytes) generates string twice as long as given parameter
+        $length = (int) ceil($length / 2);
+
+        return bin2hex(random_bytes($length));
+    }
+
     /**
      * Force to be used in PHPUnit context.
      */