Skip to content

Commit

Permalink
Merge pull request #1391 from hydephp/fix-wrong-version-constant
Browse files Browse the repository at this point in the history
Fix wrong version constant hydephp/develop@9e6fa3e
  • Loading branch information
github-actions committed Oct 19, 2023
1 parent ff22637 commit 70160b6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Foundation/HydeKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
28 changes: 24 additions & 4 deletions tests/Feature/HydeKernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Hyde\Framework\Testing\Feature;

use Throwable;
use Composer\InstalledVersions;
use Hyde\Facades\Features;
use Hyde\Foundation\Facades\Pages;
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 70160b6

Please sign in to comment.