[TASK] EXT:felogin unit tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Tests / Unit / Filter / AlphabeticFilterFilterTest.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 * Test case for class tx_form_System_Filter_Alphabetic.
29 *
30 * @author Andreas Lappe <a.lappe@kuehlhaus.com>
31 * @package TYPO3
32 * @subpackage form
33 */
34 class AlphabeticFilterFilterTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
35
36 /**
37 * @var \TYPO3\CMS\Form\Filter\AlphabeticFilter
38 */
39 protected $fixture;
40
41 public function setUp() {
42 $this->fixture = new \TYPO3\CMS\Form\Filter\AlphabeticFilter();
43 }
44
45 public function tearDown() {
46 unset($this->fixture);
47 }
48
49 /**
50 * @test
51 */
52 public function filterForStringWithUnicodeCharactersAndSpacesReturnsInputString() {
53 $input = 'My name contains äøüößØœ';
54 // This is default, but let's be explicit:
55 $this->fixture->setAllowWhiteSpace(TRUE);
56 $this->assertSame($input, $this->fixture->filter($input));
57 }
58
59 /**
60 * @test
61 */
62 public function filterForStringWithUnicodeCharactersAndSpacesWithAllowWhitespaceSetToFalseReturnsInputStringWithoutSpaces() {
63 $input = 'My name contains äøüößØœ';
64 $inputWithoutSpaces = 'MynamecontainsäøüößØœ';
65 $this->fixture->setAllowWhiteSpace(FALSE);
66 $this->assertSame($inputWithoutSpaces, $this->fixture->filter($input));
67 }
68
69 }
70
71
72 ?>