#55271Test 'filterForStringReturnsStringWithUppercasedWords' breaks ß
Description
The test fails with message:
TYPO3\CMS\Form\Tests\Unit\Filter\TitleCaseFilterTest::filterForStringReturnsStringWithUppercasedWords with data set "Ein Maß" ('Ein Maß', 'Ein Maß')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-Ein Maß
+Ein Ma<E3><9F>
typo3/sysext/form/Tests/Unit/Filter/TitleCaseFilterTest.php:72
My setup:
OSX 10.8.5 $ locale LANG="de_DE.UTF-8" LC_COLLATE="de_DE.UTF-8" LC_CTYPE="de_DE.UTF-8" LC_MESSAGES="de_DE.UTF-8" LC_MONETARY="de_DE.UTF-8" LC_NUMERIC="de_DE.UTF-8" LC_TIME="de_DE.UTF-8" LC_ALL=
I got it running with the following changing in the code:
class TitleCaseFilterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
...
/**
* Set up
*/
public function setUp() {
mb_internal_encoding('UTF-8'); // adding this
$this->fixture = new \TYPO3\CMS\Form\Filter\TitleCaseFilter();
}
class TitleCaseFilter implements \TYPO3\CMS\Form\Filter\FilterInterface {
/**
* Convert alphabetic characters to title case
*
* @param string $value
* @return string
*/
public function filter($value) {
return ucwords(mb_strtolower((string) $value)); // using mb_strtolower instead of strtolower
}
}