diff options
author | msquare <msquare@notrademark.de> | 2019-07-21 13:38:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-21 13:38:05 +0200 |
commit | 1e16f4c47ec15ffea41e1fa612d205b8db2a16d1 (patch) | |
tree | 0d436535bd7094a201e52036acd406f00bfc620f /tests/Unit/Helpers | |
parent | 3d8476efd3709806d254b1c41e26e906080e0b39 (diff) | |
parent | 4582f808f05205e7a32ecd6ae42dee00295872f1 (diff) |
Merge pull request #624 from MyIgel/version
Added version to credits and metrics page
Diffstat (limited to 'tests/Unit/Helpers')
-rw-r--r-- | tests/Unit/Helpers/Stub/files/VERSION | 1 | ||||
-rw-r--r-- | tests/Unit/Helpers/VersionServiceProviderTest.php | 25 | ||||
-rw-r--r-- | tests/Unit/Helpers/VersionTest.php | 28 |
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/Unit/Helpers/Stub/files/VERSION b/tests/Unit/Helpers/Stub/files/VERSION new file mode 100644 index 00000000..749a96f3 --- /dev/null +++ b/tests/Unit/Helpers/Stub/files/VERSION @@ -0,0 +1 @@ +0.42.0-testing diff --git a/tests/Unit/Helpers/VersionServiceProviderTest.php b/tests/Unit/Helpers/VersionServiceProviderTest.php new file mode 100644 index 00000000..609c649d --- /dev/null +++ b/tests/Unit/Helpers/VersionServiceProviderTest.php @@ -0,0 +1,25 @@ +<?php + +namespace Engelsystem\Test\Unit\Helpers; + +use Engelsystem\Application; +use Engelsystem\Helpers\Version; +use Engelsystem\Helpers\VersionServiceProvider; +use Engelsystem\Test\Unit\ServiceProviderTest; + +class VersionServiceProviderTest extends ServiceProviderTest +{ + /** + * @covers \Engelsystem\Helpers\VersionServiceProvider::register + */ + public function testRegister() + { + $app = new Application(); + $app->instance('path.storage.app', '/tmp'); + + $serviceProvider = new VersionServiceProvider($app); + $serviceProvider->register(); + + $this->assertArrayHasKey(Version::class, $app->contextual); + } +} diff --git a/tests/Unit/Helpers/VersionTest.php b/tests/Unit/Helpers/VersionTest.php new file mode 100644 index 00000000..40569abb --- /dev/null +++ b/tests/Unit/Helpers/VersionTest.php @@ -0,0 +1,28 @@ +<?php + +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() + { + $config = new Config(); + $version = new Version(__DIR__ . '/Stub', $config); + + $this->assertEquals('n/a', $version->getVersion()); + + $version = new Version(__DIR__ . '/Stub/files', $config); + $this->assertEquals('0.42.0-testing', $version->getVersion()); + + $config->set('version', '1.2.3-dev'); + $this->assertEquals('1.2.3-dev', $version->getVersion()); + } +} |