Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankraemer committed Sep 26, 2024
1 parent 539e8de commit e3ee74b
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

use Phauthentic\CodeQualityMetrics\Business\Cognitive\BaselineService;
use Phauthentic\CodeQualityMetrics\Business\Cognitive\CognitiveMetricsCollector;
use Phauthentic\CodeQualityMetrics\Business\Cognitive\FindMetricsPluginInterface;
use Phauthentic\CodeQualityMetrics\Business\Cognitive\ScoreCalculator;
use Phauthentic\CodeQualityMetrics\Business\DirectoryScanner;
use Phauthentic\CodeQualityMetrics\Business\Halstead\HalsteadMetricsCollector;
use Phauthentic\CodeQualityMetrics\Command\Cognitive\CognitiveCollectorShellOutputPlugin;
use Phauthentic\CodeQualityMetrics\Command\CognitiveMetricsCommand;
use Phauthentic\CodeQualityMetrics\Command\HalsteadMetricsCommand;
use Phauthentic\CodeQualityMetrics\Business\MetricsFacade;
Expand All @@ -21,6 +23,10 @@
use PhpParser\ParserFactory;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

Expand Down Expand Up @@ -74,6 +80,22 @@ private function registerServices(): void

$this->containerBuilder->register(NodeTraverserInterface::class, NodeTraverser::class)
->setPublic(true);

$this->containerBuilder->register(NodeTraverserInterface::class, NodeTraverser::class)
->setPublic(true);

$this->containerBuilder->register(OutputInterface::class, ConsoleOutput::class)
->setPublic(true);

$this->containerBuilder->register(InputInterface::class, ArgvInput::class)
->setPublic(true);

$this->containerBuilder->register(CognitiveCollectorShellOutputPlugin::class, CognitiveCollectorShellOutputPlugin::class)
->setArguments([
new Reference(InputInterface::class),
new Reference(OutputInterface::class)
])
->setPublic(true);
}

private function bootstrap(): void
Expand All @@ -93,6 +115,10 @@ private function bootstrapMetricsCollectors(): void
new Reference(ParserFactory::class),
new Reference(NodeTraverserInterface::class),
new Reference(DirectoryScanner::class),
new Reference(ConfigService::class),
[
$this->containerBuilder->get(CognitiveCollectorShellOutputPlugin::class),
]
])
->setPublic(true);

Expand Down Expand Up @@ -157,7 +183,10 @@ public function run(): void
{
$application = $this->containerBuilder->get(SymfonyApplication::class);
// @phpstan-ignore-next-line
$application->run();
$application->run(
$this->containerBuilder->get(InputInterface::class),
$this->containerBuilder->get(OutputInterface::class)
);
}

public function get(string $id): mixed
Expand Down

0 comments on commit e3ee74b

Please sign in to comment.