Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
extensions.typo3.org
extensions.typo3.org
Commits
9bee9899
Commit
9bee9899
authored
Dec 03, 2021
by
Thomas Löffler
Browse files
[TASK] Add unit tests for ValidExtensionVersionService
parent
710bc55d
Pipeline
#20475
failed with stages
in 3 minutes and 13 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extensions/ter_fe2/Tests/Unit/Service/ValidExtensionVersionServiceTest.php
0 → 100644
View file @
9bee9899
<?php
declare
(
strict_types
=
1
);
namespace
T3o\TerFe2\Tests\Service
;
/*
* This file is part of a TYPO3 extension.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use
T3o\TerFe2\Service\ValidExtensionVersionService
;
use
TYPO3\CMS\Core\Utility\VersionNumberUtility
;
class
ValidExtensionVersionServiceTest
extends
\
Nimut\TestingFramework\TestCase\AbstractTestCase
{
/**
* @test
* @param string $versionNumber
* @dataProvider isVersionStringOfExtensionVersionValidDataProvider
*/
public
function
isVersionStringOfExtensionVersionValid
(
string
$versionNumber
)
{
self
::
assertTrue
(
ValidExtensionVersionService
::
isVersionStringValid
(
$versionNumber
)
);
}
/**
* @test
* @param string $versionNumber
* @dataProvider isVersionStringOfExtensionVersionInvalidDataProvider
*/
public
function
isVersionStringOfExtensionVersionInvalid
(
string
$versionNumber
)
{
self
::
assertFalse
(
ValidExtensionVersionService
::
isVersionStringValid
(
$versionNumber
)
);
}
/**
* Data provider for isVersionStringOfExtensionVersionValid
*
* @return array
*/
public
function
isVersionStringOfExtensionVersionValidDataProvider
()
{
return
[
[
'Version 1.0.0 is valid'
=>
'1.0.0'
],
[
'Version 1.99.0 is valid'
=>
'1.99.0'
],
[
'Version 1.999.999 is valid'
=>
'1.999.999'
],
[
'Version 0.999.999 is valid'
=>
'0.999.999'
],
[
'Version 0.0.0 is valid'
=>
'0.0.0'
],
];
}
/**
* Data provider for isVersionStringOfExtensionVersionInvalid
*
* @return array
*/
public
function
isVersionStringOfExtensionVersionInvalidDataProvider
()
{
return
[
[
'Version 1.0.00 is invalid'
=>
'1.0.00'
],
[
'Version 01.0.0 is invalid'
=>
'01.0.0'
],
[
'Version 1.0.0-beta is invalid'
=>
'1.0.0-beta'
],
[
'Version 1.0.0 - dev is invalid'
=>
'1.0.0 - dev'
],
[
'Version v1.0.0 is invalid'
=>
'v1.0.0'
],
[
'Version 1.0.9999 is invalid'
=>
'1.0.9999'
],
[
'Version 1.0 is invalid'
=>
'1.0'
],
[
'Version 1.0.0 Free is invalid'
=>
'1.0.0 Free'
],
];
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment