From 9f1e0c7076af682ff65f5a9a5159b9ec4d305579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Tue, 5 Nov 2024 10:37:31 +0100 Subject: [PATCH] test: Add check to ensure the right version of Composer is used --- 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 @@ +