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`
This commit is contained in:
ArthurHoaro 2017-01-07 14:28:58 +01:00
parent 236239be75
commit 1255a42cfe
2 changed files with 62 additions and 9 deletions

View file

@ -282,4 +282,24 @@ class UtilsTest extends PHPUnit_Framework_TestCase
$this->assertEquals('', normalize_spaces(''));
$this->assertEquals(null, normalize_spaces(null));
}
/**
* Test arrays_combine
*/
public function testArraysCombination()
{
$arr = [['ab', 'cd'], ['ef', 'gh'], ['ij', 'kl'], ['m']];
$expected = [
'abefijm',
'cdefijm',
'abghijm',
'cdghijm',
'abefklm',
'cdefklm',
'abghklm',
'cdghklm',
];
$this->assertEquals($expected, arrays_combination($arr));
}
}