Commit 9bee9899 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

[TASK] Add unit tests for ValidExtensionVersionService

parent 710bc55d
Pipeline #20475 failed with stages
in 3 minutes and 13 seconds
<?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'],
];
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment