]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/UtilsTest.php
Prepare settings for the API in the admin page and during the install
[github/shaarli/Shaarli.git] / tests / UtilsTest.php
index 6a7870c4620ac5cd3bbf2a838f108c27755dd411..0cf9a921ed0ee979da42d0ec3d5846e822c919f7 100644 (file)
@@ -253,4 +253,21 @@ class UtilsTest extends PHPUnit_Framework_TestCase
             is_session_id_valid('c0ZqcWF3VFE2NmJBdm1HMVQ0ZHJ3UmZPbTFsNGhkNHI=')
         );
     }
+
+    /**
+     * Test generateSecretApi.
+     */
+    public function testGenerateSecretApi()
+    {
+        $this->assertEquals(12, strlen(generate_api_secret('foo', 'bar')));
+    }
+
+    /**
+     * Test generateSecretApi with invalid parameters.
+     */
+    public function testGenerateSecretApiInvalid()
+    {
+        $this->assertFalse(generate_api_secret('', ''));
+        $this->assertFalse(generate_api_secret(false, false));
+    }
 }