TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
DatePickerViewHelperTest.php
Go to the documentation of this file.
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 
20 
25 {
26 
30  protected $subject = null;
31 
37  protected function setUp()
38  {
39  $this->subject = $this->getAccessibleMock(DatePickerViewHelper::class, [
40  'dummy'
41  ], [], '', false);
42  }
43 
48  {
49  $input = 'd';
50  $expected = 'dd';
51  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
52  }
53 
58  {
59  $input = 'D';
60  $expected = 'D';
61  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
62  }
63 
68  {
69  $input = 'j';
70  $expected = 'o';
71  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
72  }
73 
78  {
79  $input = 'l';
80  $expected = 'DD';
81  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
82  }
83 
88  {
89  $input = 'F';
90  $expected = 'MM';
91  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
92  }
93 
98  {
99  $input = 'm';
100  $expected = 'mm';
101  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
102  }
103 
108  {
109  $input = 'M';
110  $expected = 'M';
111  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
112  }
113 
118  {
119  $input = 'n';
120  $expected = 'm';
121  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
122  }
123 
128  {
129  $input = 'Y';
130  $expected = 'yy';
131  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
132  }
133 
138  {
139  $input = 'y';
140  $expected = 'y';
141  $this->assertSame($expected, $this->subject->_call('convertDateFormatToDatePickerFormat', $input));
142  }
143 }
getAccessibleMock($originalClassName, $methods=[], array $arguments=[], $mockClassName= '', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)