4 * This file is part of the Behat Testwork.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Testwork\Cli;
13 use Behat\Testwork\ServiceContainer\Configuration\ConfigurationLoader;
14 use Behat\Testwork\ServiceContainer\ExtensionManager;
15 use Symfony\Component\Console\Command\Command as BaseCommand;
16 use Symfony\Component\Console\Input\InputInterface;
17 use Symfony\Component\Console\Output\OutputInterface;
20 * Provides debug information about the current environment.
22 * @author Konstantin Kudryashov <ever.zet@gmail.com>
24 final class DebugCommand extends BaseCommand
31 * @var ConfigurationLoader
33 private $configurationLoader;
35 * @var ExtensionManager
37 private $extensionManager;
40 * Initialises command.
42 * @param Application $application
43 * @param ConfigurationLoader $configurationLoader
44 * @param ExtensionManager $extensionManager
46 public function __construct(
47 Application $application,
48 ConfigurationLoader $configurationLoader,
49 ExtensionManager $extensionManager
51 $this->application = $application;
52 $this->configurationLoader = $configurationLoader;
53 $this->extensionManager = $extensionManager;
55 parent::__construct('debug');
61 protected function execute(InputInterface $input, OutputInterface $output)
63 $output->writeln(sprintf('%s version %s', $this->application->getName(), $this->application->getVersion()));
67 $debug = $this->configurationLoader->debugInformation();
68 $output->writeln('--- configuration');
69 $output->writeln(sprintf(' environment variable (%s): %s', $debug['environment_variable_name'], $debug['environment_variable_content']));
70 $output->writeln(sprintf(' configuration file: %s', $debug['configuration_file_path']));
74 $debug = $this->extensionManager->debugInformation();
75 $output->writeln('--- extensions');
76 $output->writeln(sprintf(' extensions loaded: %s', count($debug['extensions_list']) ? implode(', ', $debug['extensions_list']) : 'none'));