Commit 4dca8128 authored by Tomas Norre Mikkelsen's avatar Tomas Norre Mikkelsen

[TASK] Switch to >= for extensions with only minimum versions defined

parent 61be1b77
Pipeline #10499 failed with stages
in 3 minutes and 5 seconds
......@@ -180,6 +180,10 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
$version[] = VersionUtility::convertIntegerToVersionNumber($this->maximumVersion);
}
if (count($version) === 1 && $this->getRelationType() !== 'php') {
return '>= ' . $version[0];
}
return !empty($version) ? implode(' - ', $version) : '';
}
......
<?php
namespace T3o\TerFe2\Tests\Unit\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* 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 Nimut\TestingFramework\TestCase\UnitTestCase;
use T3o\TerFe2\Domain\Model\Relation;
class RelationTest extends UnitTestCase
{
/**
* @test
* @dataProvider getVersionStringDataProvider
*/
public function getVersionStringTest(Relation $relation, string $expected): void
{
self::assertEquals(
$expected,
$relation->getVersionString()
);
}
public function getVersionStringDataProvider(): array
{
$relationWithMinMax = new Relation();
$relationWithMinMax->setMinimumVersion(9005000);
$relationWithMinMax->setMaximumVersion(10004099);
$relationWithOnlyMin = new Relation();
$relationWithOnlyMin->setMinimumVersion(9005000);
$relationSystem = new Relation();
$relationSystem->setRelationType('php');
$relationSystem->setMinimumVersion(5005000);
return [
'relation with min and max' => [
'relation' => $relationWithMinMax,
'expected' => '9.5.0 - 10.4.99'
],
'relation with only min' => [
'relation' => $relationWithOnlyMin,
'expected' => '>= 9.5.0'
],
'relation with only min, type system' => [
'relation' => $relationSystem,
'expected' => '5.5.0'
]
];
}
}
\ No newline at end of file
Markdown is supported
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