Skip to content

Commit

Permalink
Add more info when asking for verbose output
Browse files Browse the repository at this point in the history
Now we should show the loaded parsers and validators.

Reviewed-by: Alexandre Eher <alexandre.eher@werkspot.nl>
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
  • Loading branch information
malukenho committed Nov 16, 2020
1 parent 675bde1 commit 5f307b0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Command/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Webmozart\Assert\Assert;

use function array_map;
use function array_merge;
use function assert;
use function sprintf;

Expand Down Expand Up @@ -86,11 +87,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int
Assert::string($directory);
Assert::interfaceExists(Parser::class);

$output->writeln(array_merge(['Loaded Parsers:'], $this->config['parser']), OutputInterface::VERBOSITY_VERBOSE);

$parserHandler = new MultipleParser(...array_map(
static fn (string $class): Parser => new $class(),
$this->config['parser']
));

$output->writeln(
array_merge(['', 'Loaded Validators:'], $this->config['validator']),
OutputInterface::VERBOSITY_VERBOSE
);

$validatorHandler = new MultipleValidator(...array_map(
static fn (string $class): Validator => new $class(),
$this->config['validator']
Expand Down
21 changes: 21 additions & 0 deletions tests/functional/verbose.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Test for showing information when asking for verbose output
--FILE--
<?php

$checkRunner = require __DIR__ . '/init.php';

$checkRunner('tests/assets/cli-php-tag.md -v');

--EXPECTF--
Loaded Parsers:
Codelicia\Xulieta\Parser\MarkdownParser
Codelicia\Xulieta\Parser\RstParser

Loaded Validators:
Codelicia\Xulieta\Validator\PhpValidator

Finding documentation files on tests/assets/cli-php-tag.md


Everything is OK!

0 comments on commit 5f307b0

Please sign in to comment.