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
This commit is contained in:
ArthurHoaro 2016-12-20 11:06:22 +01:00
parent e0177549c7
commit b3051a6aae
4 changed files with 30 additions and 5 deletions

View file

@ -253,7 +253,7 @@ class UtilsTest extends PHPUnit_Framework_TestCase
is_session_id_valid('c0ZqcWF3VFE2NmJBdm1HMVQ0ZHJ3UmZPbTFsNGhkNHI=')
);
}
/**
* Test generateSecretApi.
*/
@ -270,4 +270,16 @@ class UtilsTest extends PHPUnit_Framework_TestCase
$this->assertFalse(generate_api_secret('', ''));
$this->assertFalse(generate_api_secret(false, false));
}
/**
* Test normalize_spaces.
*/
public function testNormalizeSpace()
{
$str = ' foo bar is important ';
$this->assertEquals('foo bar is important', normalize_spaces($str));
$this->assertEquals('foo', normalize_spaces('foo'));
$this->assertEquals('', normalize_spaces(''));
$this->assertEquals(null, normalize_spaces(null));
}
}