Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Command/RunTemplate/GetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions tests/src/Command/RunTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,23 @@
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;

class RunTemplateTest extends \PHPUnit\Framework\TestCase
{
protected ScheduleCommand $schedule;
protected GetCommand $get;
protected AssignCredentialCommand $assignCredential;
protected UnassignCredentialCommand $unassignCredential;
protected ListCredentialsCommand $listCredentials;

protected function setUp(): void
{
$this->schedule = new ScheduleCommand();
$this->get = new GetCommand();
$this->assignCredential = new AssignCredentialCommand();
$this->unassignCredential = new UnassignCredentialCommand();
$this->listCredentials = new ListCredentialsCommand();
Expand All @@ -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();
Expand Down
Loading