diff options
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r-- | tests/UtilsTest.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 6a7870c4..c885f552 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php | |||
@@ -253,4 +253,33 @@ 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 | } | ||
273 | |||
274 | /** | ||
275 | * Test normalize_spaces. | ||
276 | */ | ||
277 | public function testNormalizeSpace() | ||
278 | { | ||
279 | $str = ' foo bar is important '; | ||
280 | $this->assertEquals('foo bar is important', normalize_spaces($str)); | ||
281 | $this->assertEquals('foo', normalize_spaces('foo')); | ||
282 | $this->assertEquals('', normalize_spaces('')); | ||
283 | $this->assertEquals(null, normalize_spaces(null)); | ||
284 | } | ||
256 | } | 285 | } |