From 6b12352d809dbcbea6e9c2ff34d8cf38cfd16bce Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Tue, 9 Jan 2024 08:57:04 +0000 Subject: [PATCH] add test to verify that Application::VERSION match the latest git tag --- .github/workflows/ci.yaml | 6 ++++ src/Console/Application.php | 2 +- tests/Application/ApplicationTest.php | 43 +++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/Application/ApplicationTest.php diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3dac145..571b068 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -72,5 +72,11 @@ jobs: run: composer update --optimize-autoloader --no-interaction --no-progress --prefer-dist ${{ matrix.composer-flags }} - name: Run tests + if: github.ref_type == 'branch' + shell: bash + run: composer run test --exclude-group tags + + - name: Run release tests + if: github.ref_type == 'tag' shell: bash run: composer run test diff --git a/src/Console/Application.php b/src/Console/Application.php index c56ac45..f303102 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -14,7 +14,7 @@ class Application extends BaseApplication { - public const VERSION = '3.3.0'; + public const VERSION = '3.4.0'; private const NAME = 'phpmnd'; private Container $container; diff --git a/tests/Application/ApplicationTest.php b/tests/Application/ApplicationTest.php new file mode 100644 index 0000000..d0f7737 --- /dev/null +++ b/tests/Application/ApplicationTest.php @@ -0,0 +1,43 @@ +setAutoExit(false); + + $this->applicationTester = new ApplicationTester($application); + } + + public function testApplicationVersionInstalled(): void + { + $this->applicationTester->run(['--version', '--no-ansi']); + + $installedVersion = \ltrim( + (new Version('', dirname(__DIR__, 2)))->getVersion(), + '-v' + ); + + $this->assertSame( + \sprintf('phpmnd version %s by Povilas Susinskas', $installedVersion), + \trim($this->applicationTester->getDisplay()) + ); + } +}