TYPO3 CMS  TYPO3_7-6
VersionNumberUtilityTest.php
Go to the documentation of this file.
1 <?php
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 
19 
24 {
31  {
32  return [
33  ['4003003', '4.3.3'],
34  ['4012003', '4.12.3'],
35  ['5000000', '5.0.0'],
36  ['5000001', '5.0.1'],
37  ['3008001', '3.8.1'],
38  ['1012', '0.1.12']
39  ];
40  }
41 
49  {
50  return [
51  'boolean' => [true],
52  'float' => [5.4],
53  'array' => [[]],
54  'string' => ['300ABCD'],
55  'object' => [new \stdClass()],
56  'NULL' => [null],
57  'function' => [function () {
58  }]
59  ];
60  }
61 
67  {
68  $this->assertEquals($expected, VersionNumberUtility::convertVersionNumberToInteger($version));
69  }
70 
75  public function convertIntegerToVersionNumberConvertsIntegerToVersionNumber($versionNumber, $expected)
76  {
77  // Make sure incoming value is an integer
78  $versionNumber = (int)$versionNumber;
79  $this->assertEquals($expected, VersionNumberUtility::convertIntegerToVersionNumber($versionNumber));
80  }
81 
87  {
88  $this->setExpectedException('\\InvalidArgumentException', '', 1334072223);
90  }
91 
96  {
97  return [
98  [
99  '6.0-dev',
100  '6.0.0'
101  ],
102  [
103  '4.5-alpha',
104  '4.5.0'
105  ],
106  [
107  '4.5-beta',
108  '4.5.0'
109  ],
110  [
111  '4.5-RC',
112  '4.5.0'
113  ],
114  [
115  '6.0.1',
116  '6.0.1'
117  ],
118  [
119  '6.2.0beta5',
120  '6.2.0'
121  ],
122  ];
123  }
124 
134  public function getNumericTypo3VersionNumber($currentVersion, $expectedVersion)
135  {
137  $this->assertEquals($expectedVersion, VersionNumberUtilityFixture::getNumericTypo3Version());
138  }
139 
146  {
147  return [
148  'everything ok' => [
149  '4.2.0-4.4.99',
150  [
151  '4.2.0',
152  '4.4.99'
153  ]
154  ],
155  'too high value' => [
156  '4.2.0-4.4.2990',
157  [
158  '4.2.0',
159  '4.4.999'
160  ]
161  ],
162  'empty high value' => [
163  '4.2.0-0.0.0',
164  [
165  '4.2.0',
166  ''
167  ]
168  ]
169  ];
170  }
171 
176  public function convertVersionsStringToVersionNumbersForcesVersionNumberInRange($versionString, $expectedResult)
177  {
179  $this->assertEquals($expectedResult, $versions);
180  }
181 }
static convertVersionsStringToVersionNumbers($versionsString)
convertVersionsStringToVersionNumbersForcesVersionNumberInRange($versionString, $expectedResult)