I have project in SF4 and use phpunit 6.5.8. I tested service that use iconv:
iconv('UTF-8', 'ASCII//TRANSLIT', $string)
When I use this service in application and when $string has value: "ąbć", returned is "abc" but when the same service is runed in phpunit returned is "?b?".
I don't understand why it don't work... Of course the test is negative but in application it works good.
Ok, I solved a problem. Php in CLI don't set locale. So we must set it before tests.
locale -a
For example:
$ locale -a
C
C.UTF-8
en_US.utf8
setlocale(LC_CTYPE, 'en_US.utf8');
public static function setUpBeforeClass()
{
setlocale(LC_CTYPE, 'en_US.utf8');
}
source: