aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/UtilsTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-12-20 11:06:22 +0100
committerArthurHoaro <arthur@hoa.ro>2017-01-03 09:47:15 +0100
commitb3051a6aae446e063c3b6fa4a6a600357a9f24af (patch)
treebefc1823dfc935fd827e6753b48f53d8150c3493 /tests/UtilsTest.php
parente0177549c760b143efdd17b1579e0c0199dce939 (diff)
downloadShaarli-b3051a6aae446e063c3b6fa4a6a600357a9f24af.tar.gz
Shaarli-b3051a6aae446e063c3b6fa4a6a600357a9f24af.tar.zst
Shaarli-b3051a6aae446e063c3b6fa4a6a600357a9f24af.zip
Fixes presence of empty tags for private tags and in search results
* Private tags: make sure empty tags are properly filtered * Search results: * Use preg_split instead of function combination * Add normalize_spaces to remove extra whitespaces displaying empty tags search
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r--tests/UtilsTest.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php
index 0cf9a921..c885f552 100644
--- a/tests/UtilsTest.php
+++ b/tests/UtilsTest.php
@@ -253,7 +253,7 @@ class UtilsTest extends PHPUnit_Framework_TestCase
253 is_session_id_valid('c0ZqcWF3VFE2NmJBdm1HMVQ0ZHJ3UmZPbTFsNGhkNHI=') 253 is_session_id_valid('c0ZqcWF3VFE2NmJBdm1HMVQ0ZHJ3UmZPbTFsNGhkNHI=')
254 ); 254 );
255 } 255 }
256 256
257 /** 257 /**
258 * Test generateSecretApi. 258 * Test generateSecretApi.
259 */ 259 */
@@ -270,4 +270,16 @@ class UtilsTest extends PHPUnit_Framework_TestCase
270 $this->assertFalse(generate_api_secret('', '')); 270 $this->assertFalse(generate_api_secret('', ''));
271 $this->assertFalse(generate_api_secret(false, false)); 271 $this->assertFalse(generate_api_secret(false, false));
272 } 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 }
273} 285}