diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-01-07 14:28:58 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-03-06 20:32:17 +0100 |
commit | 1255a42cfed9ce419962c6cf29181a66c7e22bb8 (patch) | |
tree | e92764508705da4780653d8789ad90273e80e476 /tests/UtilsTest.php | |
parent | 236239be752a7bb24547237b5751ac4fcbc0e549 (diff) | |
download | Shaarli-1255a42cfed9ce419962c6cf29181a66c7e22bb8.tar.gz Shaarli-1255a42cfed9ce419962c6cf29181a66c7e22bb8.tar.zst Shaarli-1255a42cfed9ce419962c6cf29181a66c7e22bb8.zip |
Improve autoLocale() detection
- Creates arrays_combination function to cover all cases
- add the underscore separator in the regex
- add `utf8` encoding in addition to `UTF-8`
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r-- | tests/UtilsTest.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index c885f552..b8f608b9 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php | |||
@@ -282,4 +282,24 @@ class UtilsTest extends PHPUnit_Framework_TestCase | |||
282 | $this->assertEquals('', normalize_spaces('')); | 282 | $this->assertEquals('', normalize_spaces('')); |
283 | $this->assertEquals(null, normalize_spaces(null)); | 283 | $this->assertEquals(null, normalize_spaces(null)); |
284 | } | 284 | } |
285 | |||
286 | /** | ||
287 | * Test arrays_combine | ||
288 | */ | ||
289 | public function testArraysCombination() | ||
290 | { | ||
291 | $arr = [['ab', 'cd'], ['ef', 'gh'], ['ij', 'kl'], ['m']]; | ||
292 | $expected = [ | ||
293 | 'abefijm', | ||
294 | 'cdefijm', | ||
295 | 'abghijm', | ||
296 | 'cdghijm', | ||
297 | 'abefklm', | ||
298 | 'cdefklm', | ||
299 | 'abghklm', | ||
300 | 'cdghklm', | ||
301 | ]; | ||
302 | $this->assertEquals($expected, arrays_combination($arr)); | ||
303 | } | ||
304 | |||
285 | } | 305 | } |