‪TYPO3CMS  10.4
ExtensionXmlPullParserTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
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 
19 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
23 class ‪ExtensionXmlPullParserTest extends UnitTestCase
24 {
29  public function ‪isValidVersionNumber(string $versionNumber, bool $isValid): void
30  {
31  $subject = $this->getAccessibleMock(ExtensionXmlPullParser::class, ['dummy']);
32  $subject->_set('version', $versionNumber);
33 
34  self::assertEquals($isValid, $subject->isValidVersionNumber());
35  }
36 
37  public function ‪isValidVersionNumberDataProvider(): \Generator
38  {
39  yield 'Successive zeros are not allowed' => [
40  '00.2.3',
41  false,
42  ];
43  yield 'Version premodifiers are not allowed' => [
44  'v11.2.3',
45  false,
46  ];
47  yield 'Version postmodifiers are not allowed' => [
48  '11.2.3-pre-release',
49  false,
50  ];
51  yield 'Characters are not allowed in general' => [
52  '11.a.3',
53  false,
54  ];
55  yield 'More than three characters are not allowed' => [
56  '11.2.3999',
57  false,
58  ];
59  yield 'Version most use three segements (major, minor, patch)' => [
60  '11.2',
61  false,
62  ];
63  yield 'Successive separators are not allowed' => [
64  '11..2',
65  false,
66  ];
67  yield 'Leading separator is not allowed' => [
68  '.11.2',
69  false,
70  ];
71  yield 'Invalid separator' => [
72  '11-2-3',
73  false,
74  ];
75  yield 'Missing separator' => [
76  '1123',
77  false,
78  ];
79  yield 'Valid version number' => [
80  '11.2.3',
81  true,
82  ];
83  }
84 }
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\Parser\ExtensionXmlPullParserTest\isValidVersionNumberDataProvider
‪isValidVersionNumberDataProvider()
Definition: ExtensionXmlPullParserTest.php:37
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\Parser\ExtensionXmlPullParserTest\isValidVersionNumber
‪isValidVersionNumber(string $versionNumber, bool $isValid)
Definition: ExtensionXmlPullParserTest.php:29
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\Parser
Definition: ExtensionXmlPullParserTest.php:18
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\Parser\ExtensionXmlPullParserTest
Definition: ExtensionXmlPullParserTest.php:24
‪TYPO3\CMS\Extensionmanager\Utility\Parser\ExtensionXmlPullParser
Definition: ExtensionXmlPullParser.php:28