6be9c85a0b877df59323760fb7ada159a7a645e2
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Tests / Unit / Filter / LowerCaseFilterTest.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
17 /**
18 * Test case
19 *
20 * @author Andreas Lappe <nd@kaeufli.ch>
21 */
22 class LowerCaseFilterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
23
24 /**
25 * @var \TYPO3\CMS\Form\Filter\LowerCaseFilter
26 */
27 protected $fixture;
28
29 protected function setUp() {
30 $this->fixture = new \TYPO3\CMS\Form\Filter\LowerCaseFilter();
31 $GLOBALS['TSFE'] = new \stdClass();
32 $GLOBALS['TSFE']->csConvObj = new \TYPO3\CMS\Core\Charset\CharsetConverter();
33 $GLOBALS['TSFE']->renderCharset = 'utf-8';
34 }
35
36 public function dataProvider() {
37 return array(
38 'a -> a' => array('a', 'a'),
39 'A -> a' => array('A', 'a'),
40 'AaA -> aaa' => array('AaA', 'aaa'),
41 'ÜßbÉØ -> üßbéø' => array('ÜßbÉØ', 'üßbéø'),
42 '01A23b -> 01a23b' => array('01A23b', '01a23b'),
43 );
44 }
45
46 /**
47 * @test
48 * @dataProvider dataProvider
49 */
50 public function filterForVariousInputReturnsLowercasedInput($input, $expected) {
51 $this->assertSame(
52 $expected,
53 $this->fixture->filter($input)
54 );
55 }
56
57 }