From ef90676fbe73ce8fca31646a02681639a74c6d1d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Jul 2026 08:14:49 +0000 Subject: [PATCH 1/2] Initial plan From 4cda20b77fcc9925c44235f41c77ef946c87ecf7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Jul 2026 08:17:18 +0000 Subject: [PATCH 2/2] Guard run-template:get fields option access and add regression test --- src/Command/RunTemplate/GetCommand.php | 2 +- tests/src/Command/RunTemplateTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Command/RunTemplate/GetCommand.php b/src/Command/RunTemplate/GetCommand.php index 299be79..307d409 100644 --- a/src/Command/RunTemplate/GetCommand.php +++ b/src/Command/RunTemplate/GetCommand.php @@ -61,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $runtemplate = new RunTemplate((int) $row['id']); } - $fields = $input->getOption('fields'); + $fields = $input->hasOption('fields') ? $input->getOption('fields') : null; if ($fields) { $fieldsArray = explode(',', $fields); diff --git a/tests/src/Command/RunTemplateTest.php b/tests/src/Command/RunTemplateTest.php index ed88414..7333ac3 100644 --- a/tests/src/Command/RunTemplateTest.php +++ b/tests/src/Command/RunTemplateTest.php @@ -16,6 +16,7 @@ namespace Test\MultiFlexi\Cli\Command; use MultiFlexi\Cli\Command\RunTemplate\AssignCredentialCommand; +use MultiFlexi\Cli\Command\RunTemplate\GetCommand; use MultiFlexi\Cli\Command\RunTemplate\ListCredentialsCommand; use MultiFlexi\Cli\Command\RunTemplate\ScheduleCommand; use MultiFlexi\Cli\Command\RunTemplate\UnassignCredentialCommand; @@ -23,6 +24,7 @@ class RunTemplateTest extends \PHPUnit\Framework\TestCase { protected ScheduleCommand $schedule; + protected GetCommand $get; protected AssignCredentialCommand $assignCredential; protected UnassignCredentialCommand $unassignCredential; protected ListCredentialsCommand $listCredentials; @@ -30,6 +32,7 @@ class RunTemplateTest extends \PHPUnit\Framework\TestCase protected function setUp(): void { $this->schedule = new ScheduleCommand(); + $this->get = new GetCommand(); $this->assignCredential = new AssignCredentialCommand(); $this->unassignCredential = new UnassignCredentialCommand(); $this->listCredentials = new ListCredentialsCommand(); @@ -47,6 +50,12 @@ public function testScheduleCommandHasConfigOption(): void $this->assertTrue($definition->hasOption('config'), '--config option must be defined on run-template:schedule'); } + public function testGetCommandHasFieldsOption(): void + { + $definition = $this->get->getDefinition(); + $this->assertTrue($definition->hasOption('fields'), '--fields option must be defined on run-template:get'); + } + public function testScheduleCommandHasScheduleTimeOption(): void { $definition = $this->schedule->getDefinition();