-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1 - wip: added helper class, updated tests and readme
- Loading branch information
1 parent
4bf09bf
commit 31c0327
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Version; | ||
|
||
class VersionHelper | ||
{ | ||
public static function generateShortVersion(): string | ||
{ | ||
return (new Version())->generate(); | ||
} | ||
|
||
public static function generateLongVersion(): string | ||
{ | ||
return (new Version(long: true))->generate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Blumilk\Version\VersionHelper; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class VersionHelperTest extends TestCase | ||
{ | ||
public function testGeneratingVersionBasedOnGit(): void | ||
{ | ||
$version = VersionHelper::generateShortVersion(); | ||
|
||
$this->assertIsString($version); | ||
$this->assertStringNotContainsString("|", $version); | ||
} | ||
|
||
public function testGeneratingLongVersionBasedOnGit(): void | ||
{ | ||
$version = VersionHelper::generateLongVersion(); | ||
$versionHash = trim(shell_exec("git log --format='%h' -n 1")); | ||
|
||
$this->assertIsString($version); | ||
$this->assertStringContainsString("|", $version); | ||
$this->assertStringContainsString($versionHash, $version); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters