From 70160b6c85976ee8b816640bac3717538076eb51 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 19 Oct 2023 14:23:12 +0000 Subject: [PATCH] Merge pull request #1391 from hydephp/fix-wrong-version-constant Fix wrong version constant https://github.com/hydephp/develop/commit/9e6fa3edb12347cbecbe18577c1f6110acd10fca --- src/Foundation/HydeKernel.php | 2 +- tests/Feature/HydeKernelTest.php | 28 ++++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/Foundation/HydeKernel.php b/src/Foundation/HydeKernel.php index d04d88bd..047ce853 100644 --- a/src/Foundation/HydeKernel.php +++ b/src/Foundation/HydeKernel.php @@ -49,7 +49,7 @@ class HydeKernel implements SerializableContract use Serializable; use Macroable; - final public const VERSION = '1.1.0'; + final public const VERSION = '1.2.0'; protected static self $instance; diff --git a/tests/Feature/HydeKernelTest.php b/tests/Feature/HydeKernelTest.php index d8a88952..f497b9aa 100644 --- a/tests/Feature/HydeKernelTest.php +++ b/tests/Feature/HydeKernelTest.php @@ -4,6 +4,7 @@ namespace Hyde\Framework\Testing\Feature; +use Throwable; use Composer\InstalledVersions; use Hyde\Facades\Features; use Hyde\Foundation\Facades\Pages; @@ -294,11 +295,30 @@ public function test_version_constant_is_a_valid_semver_string() ); } - public function test_version_constant_is_up_to_date() + public function test_version_constant_is_up_to_date_with_composer() { - $this->assertTrue(version_compare( - HydeKernel::VERSION, InstalledVersions::getPrettyVersion('hyde/framework') - ) >= 0); + $version = InstalledVersions::getPrettyVersion('hyde/framework'); + + if (str_starts_with($version, 'dev-')) { + $this->markTestSkipped('Installed version is for development'); + } + + $this->assertSame(HydeKernel::VERSION, $version); + } + + public function test_version_constant_is_up_to_date_with_git() + { + try { + $version = trim(shell_exec('git describe --abbrev=0 --tags')); + } catch (Throwable) { + $this->markTestSkipped('Could not get version from Git'); + } + + if ('v'.HydeKernel::VERSION === $version) { + $this->assertSame('v'.HydeKernel::VERSION, $version); + } else { + $this->markTestSkipped('Version constant does not match Git version!'); + } } public function test_version_method_returns_version_constant()