[TASK] Remove old language labels in EXT:setup
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Tests / Unit / Filter / StripNewLinesFilterTest.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 class StripNewLinesFilterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
21 {
22 /**
23 * @var \TYPO3\CMS\Form\Domain\Filter\StripNewLinesFilter
24 */
25 protected $subject = null;
26
27 /**
28 * Set up
29 */
30 protected function setUp()
31 {
32 $this->subject = new \TYPO3\CMS\Form\Domain\Filter\StripNewLinesFilter();
33 }
34
35 public function dataProviderWithNewlines()
36 {
37 return [
38 'some\rtext' => ["some\rtext", 'some text'],
39 'some\ntext' => ["some\ntext", 'some text'],
40 'some\r\ntext' => ["some\r\ntext", 'some text'],
41 'somechr(13)text' => ['some' . chr(13) . 'text', 'some text'],
42 'somechr(10)text' => ['some' . chr(10) . 'text', 'some text'],
43 'somechr(13)chr(10)text' => ['some' . chr(13) . chr(10) . 'text', 'some text'],
44 'someCRtext' => ['some' . CR . 'text', 'some text'],
45 'someLFtext' => ['some' . LF . 'text', 'some text'],
46 'someCRLFtext' => ['some' . CRLF . 'text', 'some text'],
47 'some^Mtext' => ['some
48 text', 'some text'],
49 'trailing newline\r' => ["trailing newline\n", 'trailing newline '],
50 'trailing newline\n' => ["trailing newline\r", 'trailing newline '],
51 'trailing newline\r\n' => ["trailing newline\r\n", 'trailing newline '],
52 'trailing newlinechr(13)' => ['trailing newline' . chr(13), 'trailing newline '],
53 'trailing newlinechr(10)' => ['trailing newline' . chr(10), 'trailing newline '],
54 'trailing newlinechr(13)chr(10)' => ['trailing newline' . chr(13) . chr(10), 'trailing newline '],
55 'trailing newlineCR' => ['trailing newline' . CR, 'trailing newline '],
56 'trailing newlineLF' => ['trailing newline' . LF, 'trailing newline '],
57 'trailing newlineCRLF' => ['trailing newline' . CRLF, 'trailing newline '],
58 'trailing newline^M' => ['trailing newline
59 ', 'trailing newline ']
60 ];
61 }
62
63 /**
64 * @test
65 * @dataProvider dataProviderWithNewlines
66 */
67 public function filterForStringWithNewlineReturnsStringWithoutNewline($input, $expected)
68 {
69 $this->assertSame(
70 $expected,
71 $this->subject->filter($input)
72 );
73 }
74 }