[FEATURE] EXT:form - integrate new form framework
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Tests / Unit / ViewHelpers / Form / DatePickerViewHelperTest.php
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Form\Tests\Unit\ViewHelpers\Form;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 use TYPO3\CMS\Core\Tests\UnitTestCase;
19 use TYPO3\CMS\Form\ViewHelpers\Form\DatePickerViewHelper;
20
21 /**
22 * Test case
23 */
24 class DatePickerViewHelperTest extends UnitTestCase
25 {
26
27 /**
28 * @var \TYPO3\CMS\Form\ViewHelpers\Form\DatePickerViewHelper
29 */
30 protected $subject = null;
31
32 /**
33 * Set up
34 *
35 * @return void
36 */
37 protected function setUp()
38 {
39 $this->subject = $this->getAccessibleMock(DatePickerViewHelper::class, [
40 'dummy'
41 ], [], '', false);
42 }
43
44 /**
45 * @test
46 */
47 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat01()
48 {
49 $input = 'd';
50 $expected = 'dd';
51 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
52 }
53
54 /**
55 * @test
56 */
57 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat02()
58 {
59 $input = 'D';
60 $expected = 'D';
61 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
62 }
63
64 /**
65 * @test
66 */
67 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat03()
68 {
69 $input = 'j';
70 $expected = 'o';
71 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
72 }
73
74 /**
75 * @test
76 */
77 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat04()
78 {
79 $input = 'l';
80 $expected = 'DD';
81 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
82 }
83
84 /**
85 * @test
86 */
87 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat05()
88 {
89 $input = 'F';
90 $expected = 'MM';
91 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
92 }
93
94 /**
95 * @test
96 */
97 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat06()
98 {
99 $input = 'm';
100 $expected = 'mm';
101 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
102 }
103
104 /**
105 * @test
106 */
107 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat07()
108 {
109 $input = 'M';
110 $expected = 'M';
111 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
112 }
113
114 /**
115 * @test
116 */
117 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat08()
118 {
119 $input = 'n';
120 $expected = 'm';
121 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
122 }
123
124 /**
125 * @test
126 */
127 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat09()
128 {
129 $input = 'Y';
130 $expected = 'yy';
131 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
132 }
133
134 /**
135 * @test
136 */
137 public function convertDateFormatToDatePickerFormatReturnsTransformedFormat10()
138 {
139 $input = 'y';
140 $expected = 'y';
141 $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
142 }
143 }