41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Command;
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
use App\Service\HubCounter;
|
|
|
|
class TestHubCounterCommand extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
$this->setName('test:hubcounter')
|
|
->setDescription('Test hubcounter service. Currently tests addAvailableRider and getAvailableRiderCount.')
|
|
->setHelp('Test hubcounter service. Currently tests addAvailableRider and getAvailableRiderCount.')
|
|
->addArgument('hub_id', InputArgument::REQUIRED, 'Hub ID');
|
|
}
|
|
|
|
public function __construct(HubCounter $hc)
|
|
{
|
|
$this->hc = $hc;
|
|
|
|
parent::__construct();
|
|
}
|
|
|
|
public function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$hub_id = $input->getArgument('hub_id');
|
|
|
|
$this->hc->addAvailableRider($hub_id);
|
|
|
|
$available_rc = $this->hc->getAvailableRiderCount($hub_id);
|
|
|
|
echo "Available Riders in Hub: " . $available_rc . "\n";
|
|
|
|
return 0;
|
|
}
|
|
}
|