diff --git a/src/InfoExtension.php b/src/InfoExtension.php index be1785ec..80449fd0 100644 --- a/src/InfoExtension.php +++ b/src/InfoExtension.php @@ -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"; } @@ -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 . ")"; + } } diff --git a/src/mytester.php b/src/mytester.php index 73471e4c..5e1394c9 100644 --- a/src/mytester.php +++ b/src/mytester.php @@ -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); }