Skip to content

Commit

Permalink
PHPUnit fix bug: 'Undefined array key 1' with test case base on use s…
Browse files Browse the repository at this point in the history
…etlocale(LC_ALL, 0) return unexpected string format.

Expected string format like that: setlocale(LC_ALL, 0) === 'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;...'

Actual string format on apline container: setlocale(LC_ALL, 0) === 'C.UTF-8;C;C;C;C;C'
missing part '=Something'
  • Loading branch information
hungtrinh committed Nov 16, 2022
1 parent 9d2ed51 commit a919093
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/Zend/LocaleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function tearDown(): void
$locales = [];
foreach (explode(';', $this->_locale) as $l) {
$tmp = explode('=', $l);
$locales[$tmp[0]] = $tmp[1];
$locales[$tmp[0]] = count($tmp) > 1 ? $tmp[1] : $tmp[0];
}
setlocale(LC_ALL, $locales);
return;
Expand Down
2 changes: 1 addition & 1 deletion tests/Zend/Validate/FloatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function tearDown(): void
$locales = [];
foreach (explode(';', $this->_locale) as $l) {
$tmp = explode('=', $l);
$locales[$tmp[0]] = $tmp[1];
$locales[$tmp[0]] = count($tmp) > 1 ? $tmp[1] : $tmp[0];
}
setlocale(LC_ALL, $locales);
return;
Expand Down

0 comments on commit a919093

Please sign in to comment.