From a633e8b06d8bc44d7ee70a8cbebaa6ab1084c31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <5175937+theofidry@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:41:17 +0100 Subject: [PATCH] test: Add check to ensure the right version of Composer is used (#164) --- tests/ComposerVersionProvider.php | 35 +++++++++++++++++++++++++++ tests/ComposerVersionProviderTest.php | 33 +++++++++++++++++++++++++ tests/EndToEndTest.php | 14 +++++++++-- 3 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 tests/ComposerVersionProvider.php create mode 100644 tests/ComposerVersionProviderTest.php diff --git a/tests/ComposerVersionProvider.php b/tests/ComposerVersionProvider.php new file mode 100644 index 0000000..f58d0b3 --- /dev/null +++ b/tests/ComposerVersionProvider.php @@ -0,0 +1,35 @@ +mustRun(); + + $output = $composerVersionProcess->getOutput(); + + return self::extractComposerVersion($output); + } + + private static function extractComposerVersion(string $versionOutput): string + { + preg_match('/Composer version (?\d+\.\d+\.\d+) /', $versionOutput, $matches); + + return $matches['version']; + } +} diff --git a/tests/ComposerVersionProviderTest.php b/tests/ComposerVersionProviderTest.php new file mode 100644 index 0000000..000fff1 --- /dev/null +++ b/tests/ComposerVersionProviderTest.php @@ -0,0 +1,33 @@ +