Skip to content

Commit

Permalink
fix: Adding CLI batch command-handler wrapper missed in migration. (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
fibble authored Apr 23, 2024
1 parent 9428533 commit d6a0771
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/api/module/Cli/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
'batch:database-maintenance' => Dvsa\Olcs\Cli\Command\Batch\DatabaseMaintenanceCommand::class,
'batch:digital-continuation-reminders' => Dvsa\Olcs\Cli\Command\Batch\DigitalContinuationRemindersCommand::class,
'batch:duplicate-vehicle-warning' => Dvsa\Olcs\Cli\Command\Batch\DuplicateVehicleWarningCommand::class,
'batch:duplicate-vehicle-removal' => Dvsa\Olcs\Cli\Command\Batch\DuplicateVehicleRemovalCommand::class,
'batch:enqueue-ch-compare' => Dvsa\Olcs\Cli\Command\Batch\EnqueueCompaniesHouseCompareCommand::class,
'batch:expire-bus-registration' => Dvsa\Olcs\Cli\Command\Batch\ExpireBusRegistrationCommand::class,
'batch:flag-urgent-tasks' => Dvsa\Olcs\Cli\Command\Batch\FlagUrgentTasksCommand::class,
Expand Down Expand Up @@ -84,6 +85,7 @@
BatchCommands\DatabaseMaintenanceCommand::class => $commonBatchCommandDeps,
BatchCommands\DigitalContinuationRemindersCommand::class => $commonBatchCommandDeps,
BatchCommands\DuplicateVehicleWarningCommand::class => $commonBatchCommandDeps,
BatchCommands\DuplicateVehicleRemovalCommand::class => $commonBatchCommandDeps,
BatchCommands\EnqueueCompaniesHouseCompareCommand::class => $commonBatchCommandDeps,
BatchCommands\ExpireBusRegistrationCommand::class => $commonBatchCommandDeps,
BatchCommands\FlagUrgentTasksCommand::class => $commonBatchCommandDeps,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Dvsa\Olcs\Cli\Command\Batch;

use Dvsa\Olcs\Api\Domain\Command\Vehicle\ProcessDuplicateVehicleRemoval;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DuplicateVehicleRemovalCommand extends AbstractBatchCommand
{
protected static $defaultName = 'batch:duplicate-vehicle-removal';

protected function configure()
{
$this->setDescription('Duplicate vehicle removal');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->initializeOutputInterface($output);

$result = $this->handleCommand([ProcessDuplicateVehicleRemoval::create([])]);

return $this->outputResult(
$result,
'Successfully removed duplicate vehicles',
'Failed to remove duplicate vehicles'
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Dvsa\OlcsTest\Cli\Command\Batch;

use Dvsa\Olcs\Api\Domain\Command\Vehicle\ProcessDuplicateVehicleRemoval;
use Dvsa\Olcs\Cli\Command\Batch\DuplicateVehicleRemovalCommand;

class DuplicateVehicleRemovalCommandTest extends AbstractBatchCommandCases
{
protected function getCommandClass()
{
return DuplicateVehicleRemovalCommand::class;
}

protected function getCommandName()
{
return 'batch:duplicate-vehicle-removal';
}

protected function getCommandDTOs()
{
return [
ProcessDuplicateVehicleRemoval::create([]),
];
}
}

0 comments on commit d6a0771

Please sign in to comment.