From cbfdcff2615e901bdc434d06f38a3da8eecbdf8b Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 31 Jul 2016 10:46:17 +0200 Subject: Prepare settings for the API in the admin page and during the install API settings: - api.enabled - api.secret The API settings will be initialized (and the secret generated) with an update method. --- tests/UtilsTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/UtilsTest.php') diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 6a7870c4..0cf9a921 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -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)); + } } -- cgit v1.2.3