[BUGFIX] Handle utf8 strings in TitleCaseFilter
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Tests / Unit / Filter / TitleCaseFilterTest.php
1 <?php
2 namespace TYPO3\CMS\Form\Tests\Unit\Filter;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 use TYPO3\CMS\Core\Charset\CharsetConverter;
17 use TYPO3\CMS\Form\Filter\TitleCaseFilter;
18
19 /**
20 * Test case
21 *
22 * @author Andreas Lappe <nd@kaeufli.ch>
23 */
24 class TitleCaseFilterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
25
26 /**
27 * @var TitleCaseFilter
28 */
29 protected $fixture = NULL;
30
31 /**
32 * Set up
33 */
34 public function setUp() {
35 $this->fixture = new TitleCaseFilter();
36 $GLOBALS['TSFE'] = new \stdClass();
37 $GLOBALS['TSFE']->csConvObj = new CharsetConverter();
38 $GLOBALS['TSFE']->renderCharset = 'utf-8';
39 }
40
41 /**
42 * @return array
43 */
44 public function stringProvider() {
45 return array(
46 'some text' => array('some text', 'Some Text'),
47 'some Text' => array('some Text', 'Some Text'),
48 'Ein Maß' => array('Ein Maß', 'Ein Maß'),
49 '¿por que?' => array('¿por que?', '¿por Que?'),
50 );
51 }
52
53 /**
54 * @test
55 * @dataProvider stringProvider
56 */
57 public function filterForStringReturnsStringWithUppercasedWords($input, $expected) {
58 $this->assertSame(
59 $expected,
60 $this->fixture->filter($input)
61 );
62 }
63 }