engelsystem/tests/Unit/Helpers/VersionTest.php

34 lines
1013 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace Engelsystem\Test\Unit\Helpers;
use Engelsystem\Config\Config;
use Engelsystem\Helpers\Version;
use Engelsystem\Test\Unit\ServiceProviderTest;
class VersionTest extends ServiceProviderTest
{
/**
* @covers \Engelsystem\Helpers\Version::__construct
* @covers \Engelsystem\Helpers\Version::getVersion
*/
public function testGetVersion(): void
{
$config = new Config();
2023-02-28 15:58:41 +01:00
$version = new Version(__DIR__ . '/Stub', __DIR__ . '/Stub', $config);
$this->assertEquals('n/a', $version->getVersion());
2023-02-28 15:58:41 +01:00
$version = new Version(__DIR__ . '/Stub', __DIR__ . '/Stub/files', $config);
$this->assertEquals('0.42.0-testing', $version->getVersion());
2023-02-28 15:58:41 +01:00
$version = new Version(__DIR__ . '/Stub/files', __DIR__ . '/Stub', $config);
$this->assertEquals('1a2b3c4', $version->getVersion());
$config->set('version', '1.2.3-dev');
$this->assertEquals('1.2.3-dev', $version->getVersion());
}
}