Commit e7ea093b authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Thomas Löffler
Browse files

Use mock for tests

parent 72dd0fdb
......@@ -42,7 +42,6 @@ class AddCompatibleTypo3Versions extends Command
'If command is used a second time, skip already migrated fields.',
false
);
}
protected function execute(InputInterface $input, OutputInterface $output): int
......
......@@ -107,8 +107,8 @@ class VersionUtility
$max = self::getMajorVersion($max);
if ($max <= 0) {
// Only add minimal since maximal could not be extracted
$compatibleTypo3Versions[] = $min;
continue;
$compatibleTypo3Versions[] = $min;
continue;
}
// Add all major versions between min and max
$compatibleTypo3Versions = self::getVersionRange($min, $max);
......@@ -147,7 +147,7 @@ class VersionUtility
* Generate range for min and max by removing invalid version numbers
*
* @param int $min
* @param null|int $max
* @param int|null $max
* @return array
*/
protected static function getVersionRange(int $min, int $max = null): array
......
......@@ -17,6 +17,9 @@ namespace T3o\TerFe2\Tests\Unit\Utility;
* The TYPO3 project - inspiring people to share!
*/
/**
* Tests for VersionUtility
*/
class VersionUtilityTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
{
/**
......@@ -28,9 +31,11 @@ class VersionUtilityTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
*/
public function getCompatibleTypo3VersionsTest(array $dependencies, string $versionList): void
{
$subject = $this->getAccessibleMock(\T3o\TerFe2\Utility\VersionUtility::class, ['dummy']);
self::assertSame(
$versionList,
\T3o\TerFe2\Utility\VersionUtility::getCompatibleTypo3Versions($dependencies)
$subject->_call('getCompatibleTypo3Versions', $dependencies)
);
}
......@@ -154,4 +159,4 @@ class VersionUtilityTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
'9,10'
];
}
}
\ No newline at end of file
}
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