parent
0d565af13d
commit
9e6d84e085
@ -0,0 +1,63 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
/** |
||||||
|
* SPDX-License-Identifier: EUPL-1.2 |
||||||
|
* Authors: see /README.md |
||||||
|
*/ |
||||||
|
|
||||||
|
namespace Seacms\Command; |
||||||
|
|
||||||
|
use Composer\Command\BaseCommand; |
||||||
|
use Symfony\Component\Console\Input\InputInterface; |
||||||
|
use Symfony\Component\Console\Output\OutputInterface; |
||||||
|
|
||||||
|
/** |
||||||
|
* Command to lauch tests from command line accross all seacms dependencies |
||||||
|
*/ |
||||||
|
|
||||||
|
class Command extends BaseCommand |
||||||
|
{ |
||||||
|
|
||||||
|
/** |
||||||
|
* set name |
||||||
|
*/ |
||||||
|
protected function configure() { |
||||||
|
$this->setName('seacms-test'); |
||||||
|
|
||||||
|
$this |
||||||
|
// the short description shown while running "php bin/console list" |
||||||
|
->setDescription('Testing seacms from command line') |
||||||
|
|
||||||
|
// the full command description shown when running the command with |
||||||
|
// the "--help" option |
||||||
|
->setHelp("Test seacms via command line.\n". |
||||||
|
"(Only if phpunit available)\n") |
||||||
|
|
||||||
|
->addOption('toto', '', InputOption::VALUE_NONE, 'Display toto text') |
||||||
|
->addOption('text', 't', InputOption::VALUE_REQUIRED, 'Display the text') |
||||||
|
; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* execute the command |
||||||
|
* @param InputInterface $input |
||||||
|
* @param OutputInterface $output |
||||||
|
* @return int |
||||||
|
*/ |
||||||
|
protected function execute(InputInterface $input, OutputInterface $output) |
||||||
|
{ |
||||||
|
$output->writeln('<info>Testing seacms</info>'); |
||||||
|
|
||||||
|
$totoOption = $input->getOption('toto'); |
||||||
|
$textOption = $input->getOption('test'); |
||||||
|
|
||||||
|
if ($totoOption){ |
||||||
|
$output->writeln('toto'); |
||||||
|
} |
||||||
|
if ($textOption){ |
||||||
|
$output->writeln($textOption); |
||||||
|
} |
||||||
|
return Command::SUCCESS; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue