‪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 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪VersionNumberUtilityTest extends UnitTestCase
25 {
26 
33  {
34  return [
35  ['4003003', '4.3.3'],
36  ['4012003', '4.12.3'],
37  ['5000000', '5.0.0'],
38  ['5000001', '5.0.1'],
39  ['3008001', '3.8.1'],
40  ['1012', '0.1.12']
41  ];
42  }
43 
51  {
52  return [
53  'boolean' => [true],
54  'float' => [5.4],
55  'array' => [[]],
56  'string' => ['300ABCD'],
57  'object' => [new \stdClass()],
58  'NULL' => [null],
59  'function' => [function () {
60  }]
61  ];
62  }
63 
69  {
70  self::assertEquals($expected, ‪VersionNumberUtility::convertVersionNumberToInteger($version));
71  }
72 
77  public function ‪convertIntegerToVersionNumberConvertsIntegerToVersionNumber($versionNumber, $expected)
78  {
79  // Make sure incoming value is an integer
80  $versionNumber = (int)$versionNumber;
81  self::assertEquals($expected, ‪VersionNumberUtility::convertIntegerToVersionNumber($versionNumber));
82  }
83 
89  {
90  $this->expectException(\InvalidArgumentException::class);
91  $this->expectExceptionCode(1334072223);
93  }
94 }
‪TYPO3\CMS\Core\Utility\VersionNumberUtility
Definition: VersionNumberUtility.php:25
‪TYPO3\CMS\Core\Utility\VersionNumberUtility\convertIntegerToVersionNumber
‪static string convertIntegerToVersionNumber($versionInteger)
Definition: VersionNumberUtility.php:54
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\VersionNumberUtilityTest\convertIntegerToVersionNumberConvertsIntegerToVersionNumber
‪convertIntegerToVersionNumberConvertsIntegerToVersionNumber($versionNumber, $expected)
Definition: VersionNumberUtilityTest.php:77
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\VersionNumberUtilityTest\invalidVersionNumberDataProvider
‪array invalidVersionNumberDataProvider()
Definition: VersionNumberUtilityTest.php:50
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\VersionNumberUtilityTest\validVersionNumberDataProvider
‪array validVersionNumberDataProvider()
Definition: VersionNumberUtilityTest.php:32
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\VersionNumberUtilityTest\convertVersionNumberToIntegerConvertsVersionNumbersToIntegers
‪convertVersionNumberToIntegerConvertsVersionNumbersToIntegers($expected, $version)
Definition: VersionNumberUtilityTest.php:68
‪TYPO3\CMS\Core\Utility\VersionNumberUtility\convertVersionNumberToInteger
‪static int convertVersionNumberToInteger($versionNumber)
Definition: VersionNumberUtility.php:32
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Utility
Definition: GeneralUtilityTest.php:16
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\VersionNumberUtilityTest
Definition: VersionNumberUtilityTest.php:25
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\VersionNumberUtilityTest\convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber
‪convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber($version)
Definition: VersionNumberUtilityTest.php:88