‪TYPO3CMS  10.4
VersionNumberUtilityTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪VersionNumberUtilityTest extends UnitTestCase
26 {
27 
32  {
33  return [
34  [
35  '6.0-dev',
36  '6.0.0'
37  ],
38  [
39  '4.5-alpha',
40  '4.5.0'
41  ],
42  [
43  '4.5-beta',
44  '4.5.0'
45  ],
46  [
47  '4.5-RC',
48  '4.5.0'
49  ],
50  [
51  '6.0.1',
52  '6.0.1'
53  ],
54  [
55  '6.2.0beta5',
56  '6.2.0'
57  ],
58  ];
59  }
60 
70  public function ‪getNumericTypo3VersionNumber($currentVersion, $expectedVersion)
71  {
73  self::assertEquals($expectedVersion, ‪VersionNumberUtilityFixture::getNumericTypo3Version());
74  }
75 
82  {
83  return [
84  'everything ok' => [
85  '4.2.0-4.4.99',
86  [
87  '4.2.0',
88  '4.4.99'
89  ]
90  ],
91  'too high value' => [
92  '4.2.0-4.4.2990',
93  [
94  '4.2.0',
95  '4.4.999'
96  ]
97  ],
98  'empty high value' => [
99  '4.2.0-0.0.0',
100  [
101  '4.2.0',
102  ''
103  ]
104  ]
105  ];
106  }
107 
112  public function ‪convertVersionsStringToVersionNumbersForcesVersionNumberInRange($versionString, $expectedResult)
113  {
115  self::assertEquals($expectedResult, $versions);
116  }
117 }
‪TYPO3\CMS\Core\Utility\VersionNumberUtility
Definition: VersionNumberUtility.php:25
‪TYPO3\CMS\Core\Utility\VersionNumberUtility\getNumericTypo3Version
‪static string getNumericTypo3Version()
Definition: VersionNumberUtility.php:107
‪TYPO3\CMS\Core\Tests\Unit\Utility\VersionNumberUtilityTest\getNumericTypo3VersionNumberDataProvider
‪array getNumericTypo3VersionNumberDataProvider()
Definition: VersionNumberUtilityTest.php:31
‪TYPO3\CMS\Core\Tests\Unit\Utility\VersionNumberUtilityTest
Definition: VersionNumberUtilityTest.php:26
‪TYPO3\CMS\Core\Tests\Unit\Utility
‪TYPO3\CMS\Core\Tests\Unit\Utility\VersionNumberUtilityTest\convertVersionsStringToVersionNumbersForcesVersionNumberInRange
‪convertVersionsStringToVersionNumbersForcesVersionNumberInRange($versionString, $expectedResult)
Definition: VersionNumberUtilityTest.php:112
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\VersionNumberUtilityFixture\$versionNumber
‪static $versionNumber
Definition: VersionNumberUtilityFixture.php:25
‪TYPO3\CMS\Core\Tests\Unit\Utility\VersionNumberUtilityTest\getNumericTypo3VersionNumber
‪getNumericTypo3VersionNumber($currentVersion, $expectedVersion)
Definition: VersionNumberUtilityTest.php:70
‪TYPO3\CMS\Core\Tests\Unit\Utility\VersionNumberUtilityTest\convertVersionsStringToVersionNumbersForcesVersionNumberInRangeDataProvider
‪array convertVersionsStringToVersionNumbersForcesVersionNumberInRangeDataProvider()
Definition: VersionNumberUtilityTest.php:81
‪TYPO3\CMS\Core\Utility\VersionNumberUtility\convertVersionsStringToVersionNumbers
‪static array convertVersionsStringToVersionNumbers($versionsString)
Definition: VersionNumberUtility.php:137
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\VersionNumberUtilityFixture
Definition: VersionNumberUtilityFixture.php:24