diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-07-31 10:46:17 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-12-12 03:54:10 +0100 |
commit | cbfdcff2615e901bdc434d06f38a3da8eecbdf8b (patch) | |
tree | de0d67591015f1bd6d35bd8490adfc8981d3355c /tests/UtilsTest.php | |
parent | 624f999fb75ceeefbc690276f42e5a545ad35357 (diff) | |
download | Shaarli-cbfdcff2615e901bdc434d06f38a3da8eecbdf8b.tar.gz Shaarli-cbfdcff2615e901bdc434d06f38a3da8eecbdf8b.tar.zst Shaarli-cbfdcff2615e901bdc434d06f38a3da8eecbdf8b.zip |
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.
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r-- | tests/UtilsTest.php | 17 |
1 files changed, 17 insertions, 0 deletions
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 | |||
253 | is_session_id_valid('c0ZqcWF3VFE2NmJBdm1HMVQ0ZHJ3UmZPbTFsNGhkNHI=') | 253 | is_session_id_valid('c0ZqcWF3VFE2NmJBdm1HMVQ0ZHJ3UmZPbTFsNGhkNHI=') |
254 | ); | 254 | ); |
255 | } | 255 | } |
256 | |||
257 | /** | ||
258 | * Test generateSecretApi. | ||
259 | */ | ||
260 | public function testGenerateSecretApi() | ||
261 | { | ||
262 | $this->assertEquals(12, strlen(generate_api_secret('foo', 'bar'))); | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * Test generateSecretApi with invalid parameters. | ||
267 | */ | ||
268 | public function testGenerateSecretApiInvalid() | ||
269 | { | ||
270 | $this->assertFalse(generate_api_secret('', '')); | ||
271 | $this->assertFalse(generate_api_secret(false, false)); | ||
272 | } | ||
256 | } | 273 | } |