[BUGFIX] EXT:form tests and unicode fix
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Tests / Unit / Filter / AlphabeticFilterTest.php
1 <?php
2 namespace TYPO3\CMS\Form\Tests\Unit\Filter;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2012 Andreas Lappe <a.lappe@kuehlhaus.com>, kuehlhaus AG
8 *
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Testcase for AlphabeticFilter
29 *
30 * @author Andreas Lappe <a.lappe@kuehlhaus.com>
31 * @package TYPO3
32 * @subpackage form
33 */
34 class AlphabeticFilterTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
35
36 /**
37 * @var \TYPO3\CMS\Form\Filter\AlphabeticFilter
38 */
39 protected $fixture = NULL;
40
41 /**
42 * Set up
43 */
44 public function setUp() {
45 $this->fixture = new \TYPO3\CMS\Form\Filter\AlphabeticFilter();
46 }
47
48 /**
49 * Tear down
50 */
51 public function tearDown() {
52 $this->fixture = NULL;
53 }
54
55 /**
56 * @test
57 */
58 public function filterForStringWithUnicodeCharactersAndSpacesReturnsInputString() {
59 $input = 'My name contains äøüößØœ';
60 // This is default, but let's be explicit:
61 $this->fixture->setAllowWhiteSpace(TRUE);
62 $this->assertSame($input, $this->fixture->filter($input));
63 }
64
65 /**
66 * @test
67 */
68 public function filterForStringWithUnicodeCharactersAndSpacesWithAllowWhitespaceSetToFalseReturnsInputStringWithoutSpaces() {
69 $input = 'My name contains äøüößØœ';
70 $expected = 'MynamecontainsäøüößØœ';
71 $this->fixture->setAllowWhiteSpace(FALSE);
72 $this->assertSame($expected, $this->fixture->filter($input));
73 }
74
75 }
76
77
78 ?>