From b5e028df789ec437c85dd9814fb70284c8bc2c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Drunen?= Date: Tue, 26 Dec 2023 23:52:41 +0100 Subject: [PATCH] Ignore commands for installing and updating of project from code coverage --- app/Console/Commands/BudgetInstall.php | 12 +++++++----- app/Console/Commands/BudgetUpdate.php | 12 +++++++----- app/Console/Commands/UpdateVersionFile.php | 12 ++++++------ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/Console/Commands/BudgetInstall.php b/app/Console/Commands/BudgetInstall.php index bf6af856..7af88f66 100644 --- a/app/Console/Commands/BudgetInstall.php +++ b/app/Console/Commands/BudgetInstall.php @@ -6,15 +6,17 @@ use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Process; +/** + * Ignoring this command from code coverage as it is dependent on binaries + * that may or may not be installed on the machine. + * + * @codeCoverageIgnore + */ class BudgetInstall extends Command { protected $signature = 'budget:install'; - protected $description = 'Runs most of the commands needed to make Budget work'; - public function __construct() - { - parent::__construct(); - } + protected $description = 'Runs most of the commands needed to make Budget work'; private function executeCommand($command): string { diff --git a/app/Console/Commands/BudgetUpdate.php b/app/Console/Commands/BudgetUpdate.php index 6f277ef8..11065590 100644 --- a/app/Console/Commands/BudgetUpdate.php +++ b/app/Console/Commands/BudgetUpdate.php @@ -5,15 +5,17 @@ use Exception; use Illuminate\Console\Command; +/** + * Ignoring this command from code coverage as it is dependent on binaries + * that may or may not be installed on the machine. + * + * @codeCoverageIgnore + */ class BudgetUpdate extends Command { protected $signature = 'budget:update'; - protected $description = 'Update the application to the latest version'; - public function __construct() - { - parent::__construct(); - } + protected $description = 'Update the application to the latest version'; private function doesBinaryExist(string $name): bool { diff --git a/app/Console/Commands/UpdateVersionFile.php b/app/Console/Commands/UpdateVersionFile.php index bdeb3e21..6df772cf 100644 --- a/app/Console/Commands/UpdateVersionFile.php +++ b/app/Console/Commands/UpdateVersionFile.php @@ -4,18 +4,18 @@ use Illuminate\Console\Command; +/** + * Ignoring this command from code coverage as it is dependent on whether Git is + * installed or not, which can vary from machine to machine. + * + * @codeCoverageIgnore + */ class UpdateVersionFile extends Command { protected $signature = 'app:update-version-file'; protected $description = 'Updates the version in version.txt'; - /** - * Ignoring this command from code coverage as it is dependent on whether Git is - * installed or not, which can vary from machine to machine. - * - * @codeCoverageIgnore - */ public function handle(): int { if (trim(shell_exec('git rev-parse --is-inside-work-tree')) !== 'true') {