Skip to content

Commit

Permalink
added helper methods to InfoExtension for getting My Tester/PHP version
Browse files Browse the repository at this point in the history
  • Loading branch information
konecnyjakub committed Dec 20, 2024
1 parent 843bf7b commit 8f17f3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/InfoExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ public function __construct(private readonly ConsoleColors $console)

public function onTestsStarted(Events\TestsStarted $event): void
{
$version = InstalledVersions::getPrettyVersion(static::PACKAGE_NAME);
echo $this->console->color("My Tester $version\n", "silver");
echo $this->console->color(static::getTesterVersion() . "\n", "silver");
echo "\n";
echo $this->console->color("PHP " . PHP_VERSION . " (" . PHP_SAPI . ")\n", "silver");
echo $this->console->color(static::getPhpVersion() . ")\n", "silver");
echo "\n";
}

Expand All @@ -33,4 +32,15 @@ public function onTestCaseStarted(Events\TestCaseStarted $event): void
public function onTestCaseFinished(Events\TestCaseFinished $event): void
{
}

public static function getTesterVersion(): string
{
$version = InstalledVersions::getPrettyVersion(static::PACKAGE_NAME);
return "My Tester $version";
}

public static function getPhpVersion(): string
{
return "PHP " . PHP_VERSION . " (" . PHP_SAPI . ")";
}
}
3 changes: 1 addition & 2 deletions src/mytester.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
$options = $cmd->parse();

if (isset($options["--version"])) {
$version = InstalledVersions::getPrettyVersion("konecnyjakub/mytester");
echo "My Tester $version\n";
echo InfoExtension::getTesterVersion() . "\n";
exit(0);
}

Expand Down

0 comments on commit 8f17f3e

Please sign in to comment.