From f2d5ab52e8dcbffd2ea0d4bbed3a5f7a7ecf57d2 Mon Sep 17 00:00:00 2001 From: Bertrand Dunogier Date: Wed, 6 Apr 2016 16:50:37 +0200 Subject: [PATCH 1/7] [dependencies] Added phpunit ^4.7 --- composer.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composer.json b/composer.json index 4c7aefb7..82ea0549 100644 --- a/composer.json +++ b/composer.json @@ -21,5 +21,11 @@ "branch-alias": { "dev-master": "0.1.x-dev" } + }, + "config": { + "bin-dir": "bin" + }, + "require-dev": { + "phpunit/phpunit": "^4.7" } } From 1fb0f52b2e3ba945df66f9561a2a85ebd868316a Mon Sep 17 00:00:00 2001 From: Gunnstein Lye Date: Tue, 5 Apr 2016 13:43:45 +0200 Subject: [PATCH 2/7] Fix EZP-25598: eZSupportTools infocollector registry --- .../Compiler/SystemInfoCollectorPass.php | 40 ++++++++ EzSystemsEzSupportToolsBundle.php | 2 + Resources/config/services.yml | 14 +++ SystemInfo/Registry/IdentifierBased.php | 57 +++++++++++ SystemInfo/SystemInfoCollectorRegistry.php | 38 ++++++++ .../Registry/IdentifierBasedTest.php | 97 +++++++++++++++++++ 6 files changed, 248 insertions(+) create mode 100644 DependencyInjection/Compiler/SystemInfoCollectorPass.php create mode 100644 SystemInfo/Registry/IdentifierBased.php create mode 100644 SystemInfo/SystemInfoCollectorRegistry.php create mode 100644 Tests/SystemInfo/Registry/IdentifierBasedTest.php diff --git a/DependencyInjection/Compiler/SystemInfoCollectorPass.php b/DependencyInjection/Compiler/SystemInfoCollectorPass.php new file mode 100644 index 00000000..906e3199 --- /dev/null +++ b/DependencyInjection/Compiler/SystemInfoCollectorPass.php @@ -0,0 +1,40 @@ +has('support_tools.info_collector.registry')) { + return; + } + + $infoCollectorsTagged = $container->findTaggedServiceIds('support_tools.info_collector'); + + $infoCollectors = []; + foreach ($infoCollectorsTagged as $id => $tags) { + foreach ($tags as $attributes) { + $infoCollectors[$attributes['alias']] = new Reference($id); + } + } + + $infoCollectorRegistryDef = $container->findDefinition('support_tools.info_collector.registry'); + $infoCollectorRegistryDef->setArguments([$infoCollectors]); + } +} diff --git a/EzSystemsEzSupportToolsBundle.php b/EzSystemsEzSupportToolsBundle.php index bf5824d5..b374a161 100644 --- a/EzSystemsEzSupportToolsBundle.php +++ b/EzSystemsEzSupportToolsBundle.php @@ -8,6 +8,7 @@ */ namespace EzSystems\EzSupportToolsBundle; +use EzSystems\EzSupportToolsBundle\DependencyInjection\Compiler\SystemInfoCollectorPass; use EzSystems\EzSupportToolsBundle\DependencyInjection\Compiler\ViewBuilderPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -17,6 +18,7 @@ class EzSystemsEzSupportToolsBundle extends Bundle public function build(ContainerBuilder $container) { parent::build($container); + $container->addCompilerPass(new SystemInfoCollectorPass()); $container->addCompilerPass(new ViewBuilderPass()); } } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 95918691..8839533e 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -2,6 +2,7 @@ imports: - { resource: view.yml } parameters: + support_tools.info_collector.registry.class: EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased support_tools.info_collectors.composer.lock_file.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\JsonComposerLockSystemInfoCollector support_tools.info_collectors.database.doctrine.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\DoctrineDatabaseSystemInfoCollector support_tools.info_collectors.hardware.ezc.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\EzcHardwareSystemInfoCollector @@ -9,6 +10,9 @@ parameters: support_tools.info_collectors.symfony.kernel.config.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\ConfigurationSymfonyKernelSystemInfoCollector services: + support_tools.info_collector.registry: + class: %support_tools.info_collector.registry.class% + support_tools.info_collector.system_info.ezc: class: ezcSystemInfo factory: [EzSystems\EzSupportToolsBundle\SystemInfo\EzcSystemInfoFactory, buildEzcSystemInfo] @@ -17,24 +21,34 @@ services: class: %support_tools.info_collectors.composer.lock_file.class% arguments: - "%kernel.root_dir%/../composer.lock" + tags: + - { name: "support_tools.info_collector", alias: "composer" } support_tools.info_collectors.database.doctrine: class: %support_tools.info_collectors.database.doctrine.class% arguments: - @database_connection + tags: + - { name: "support_tools.info_collector", alias: "database" } support_tools.info_collectors.hardware.ezc: class: %support_tools.info_collectors.hardware.ezc.class% arguments: - @support_tools.info_collector.system_info.ezc + tags: + - { name: "support_tools.info_collector", alias: "hardware" } support_tools.info_collectors.php.ezc: class: %support_tools.info_collectors.php.ezc.class% arguments: - @support_tools.info_collector.system_info.ezc + tags: + - { name: "support_tools.info_collector", alias: "php" } support_tools.info_collectors.symfony.kernel.config: class: %support_tools.info_collectors.symfony.kernel.config.class% arguments: - @kernel - %kernel.bundles% + tags: + - { name: "support_tools.info_collector", alias: "symfony_kernel" } diff --git a/SystemInfo/Registry/IdentifierBased.php b/SystemInfo/Registry/IdentifierBased.php new file mode 100644 index 00000000..743e5e1b --- /dev/null +++ b/SystemInfo/Registry/IdentifierBased.php @@ -0,0 +1,57 @@ +registry = $items; + } + + /** + * Returns the SystemInfoCollector matching the argument. + * + * @param string $identifier An identifier string. + * + * @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException If no SystemInfoCollector exists with this identifier + * + * @return \EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector The SystemInfoCollector given by the identifier. + */ + public function getItem($identifier) + { + if (isset($this->registry[$identifier])) { + return $this->registry[$identifier]; + } + + throw new NotFoundException("A SystemInfo collector could not be found.", $identifier); + } + + /** + * Returns the identifiers of all registered SystemInfoCollectors. + * + * @return string[] Array of identifier strings. + */ + public function getIdentifiers() + { + return array_keys($this->registry); + } +} diff --git a/SystemInfo/SystemInfoCollectorRegistry.php b/SystemInfo/SystemInfoCollectorRegistry.php new file mode 100644 index 00000000..4be255ec --- /dev/null +++ b/SystemInfo/SystemInfoCollectorRegistry.php @@ -0,0 +1,38 @@ +testItems = [ + 'foo' => $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'), + 'bar' => $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'), + ]; + + $this->registry = new IdentifierBased(); + } + + /** + * Test adding items to the registry, and getting items from it. + * + * @covers \EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased::getItem() + */ + public function testAddAndGetItems() + { + $this->registry = new IdentifierBased($this->testItems); + + self::assertSame($this->testItems['foo'], $this->registry->getItem('foo')); + self::assertSame($this->testItems['bar'], $this->registry->getItem('bar')); + } + + /** + * Test exception when registry item is not found. + * + * @covers \EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased::getItem() + * + * @expectedException \eZ\Publish\Core\Base\Exceptions\NotFoundException + */ + public function testGetItemNotFound() + { + $this->registry->getItem('notfound'); + } + + /** + * Test replacing an item in the registry. + * + * @covers \EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased::getItem() + */ + public function testReplaceItem() + { + $this->registry = new IdentifierBased($this->testItems); + + $replaceItems = [ + 'foo' => $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'), + ]; + + $this->registry = new IdentifierBased($replaceItems); + + self::assertNotSame($this->testItems['foo'], $this->registry->getItem('foo')); + self::assertSame($replaceItems['foo'], $this->registry->getItem('foo')); + } + + /** + * Test getting all registered identifiers. + * + * @covers \EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased::getIdentifiers() + * @depends testAddAndGetItems + */ + public function testGetIdentifiers() + { + $this->registry = new IdentifierBased($this->testItems); + + $expectedIdentifiers = array_keys($this->testItems); + sort($expectedIdentifiers); + + $actualIdentifiers = $this->registry->getIdentifiers(); + sort($actualIdentifiers); + + self::assertEquals($expectedIdentifiers, $actualIdentifiers); + } +} From 7ccd645a53b2ee510fd11f2e5181b5acc8224d93 Mon Sep 17 00:00:00 2001 From: Gunnstein Lye Date: Tue, 5 Apr 2016 13:45:57 +0200 Subject: [PATCH 3/7] Update the View to work with the registry Part of EZP-25598: eZSupportTools infocollector registry --- Resources/config/view.yml | 5 +--- Tests/View/SystemInfoViewBuilderTest.php | 35 ++++++++++++++++-------- View/SystemInfoViewBuilder.php | 25 ++++++++--------- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/Resources/config/view.yml b/Resources/config/view.yml index 52fc33b2..782f371b 100644 --- a/Resources/config/view.yml +++ b/Resources/config/view.yml @@ -3,10 +3,7 @@ services: class: EzSystems\EzSupportToolsBundle\View\SystemInfoViewBuilder arguments: - @ezpublish.view.configurator - # temporary until we add a service tag (EZP-25598) - - - hardware: @support_tools.info_collectors.hardware.ezc - php: @support_tools.info_collectors.php.ezc + - @support_tools.info_collector.registry support_tools.view.controller: class: EzSystems\EzSupportToolsBundle\Controller\SystemInfoController diff --git a/Tests/View/SystemInfoViewBuilderTest.php b/Tests/View/SystemInfoViewBuilderTest.php index bc2679fe..97ee3870 100644 --- a/Tests/View/SystemInfoViewBuilderTest.php +++ b/Tests/View/SystemInfoViewBuilderTest.php @@ -5,23 +5,26 @@ namespace EzSystems\EzSupportToolsBundle\Tests\View; use eZ\Publish\Core\Base\Exceptions\NotFoundException; +use EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry; use EzSystems\EzSupportToolsBundle\View\SystemInfoViewBuilder; class SystemInfoViewBuilderTest extends \PHPUnit_Framework_TestCase { private $configuratorMock; + private $registryMock; + private $collectorMock; public function testMatches() { - $builder = new SystemInfoViewBuilder($this->getConfiguratorMock(), []); + $builder = new SystemInfoViewBuilder($this->getConfiguratorMock(), $this->getRegistryMock()); self::assertTrue($builder->matches('support_tools.view.controller:viewInfoAction')); } public function testNotMatches() { - $builder = new SystemInfoViewBuilder($this->getConfiguratorMock(), []); + $builder = new SystemInfoViewBuilder($this->getConfiguratorMock(), $this->getRegistryMock()); self::assertFalse($builder->matches('service:someAction')); } @@ -29,11 +32,16 @@ public function testBuildView() { $builder = new SystemInfoViewBuilder( $this->getConfiguratorMock(), - ['test' => $this->getCollectorMock()] + $this->getRegistryMock() ); $systemInfo = $this->getMock('SystemInfo'); + $this->getRegistryMock() + ->method('getItem') + ->with('test') + ->will($this->returnValue($this->getCollectorMock())); + $this->getCollectorMock() ->method('collect') ->will($this->returnValue($systemInfo)); @@ -43,15 +51,6 @@ public function testBuildView() self::assertEquals($view->getViewType(), 'test'); } - /** - * @expectedException \eZ\Publish\Core\Base\Exceptions\NotFoundException - */ - public function testBuildViewCollectorNotFound() - { - $builder = new SystemInfoViewBuilder($this->getConfiguratorMock(), []); - $builder->buildView(['systemInfoIdentifier' => 'test']); - } - /** * @return \PHPUnit_Framework_MockObject_MockObject|\eZ\Publish\Core\MVC\Symfony\View\Configurator */ @@ -64,6 +63,18 @@ protected function getConfiguratorMock() return $this->configuratorMock; } + /** + * @return \PHPUnit_Framework_MockObject_MockObject|\EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry + */ + protected function getRegistryMock() + { + if (!isset($this->registryMock)) { + $this->registryMock = $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry'); + } + + return $this->registryMock; + } + /** * @return \PHPUnit_Framework_MockObject_MockObject|\EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector */ diff --git a/View/SystemInfoViewBuilder.php b/View/SystemInfoViewBuilder.php index ee23104c..e75990bc 100644 --- a/View/SystemInfoViewBuilder.php +++ b/View/SystemInfoViewBuilder.php @@ -4,27 +4,29 @@ */ namespace EzSystems\EzSupportToolsBundle\View; -use Doctrine\Common\Inflector\Inflector; -use eZ\Publish\Core\Base\Exceptions\NotFoundException; use eZ\Publish\Core\MVC\Symfony\View\Builder\ViewBuilder; use eZ\Publish\Core\MVC\Symfony\View\Configurator; use EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector; +use EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry; class SystemInfoViewBuilder implements ViewBuilder { - /** - * @var \EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector[] - */ - private $infoCollectors; /** * @var \eZ\Publish\Core\MVC\Symfony\View\Configurator */ private $viewConfigurator; - public function __construct(Configurator $viewConfigurator, array $infoCollectors) + /** + * System info collector registry. + * + * @var \EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry + */ + private $registry; + + public function __construct(Configurator $viewConfigurator, SystemInfoCollectorRegistry $registry) { - $this->infoCollectors = $infoCollectors; $this->viewConfigurator = $viewConfigurator; + $this->registry = $registry; } public function matches($argument) @@ -47,14 +49,9 @@ public function buildView(array $parameters) * @param string $identifier A SystemInfo collector identifier (php, hardware...) * * @return \EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector - * @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException If no SystemInfoCollector exists with this identifier */ private function getCollector($identifier) { - if (!isset($this->infoCollectors[$identifier])) { - throw new NotFoundException("A SystemInfo collector could not be found.", $identifier); - } - - return $this->infoCollectors[$identifier]; + return $this->registry->getItem($identifier); } } From 8ea10ec39be6a9855fbfc8fc297fd849cd24fcd8 Mon Sep 17 00:00:00 2001 From: Gunnstein Lye Date: Tue, 5 Apr 2016 13:47:53 +0200 Subject: [PATCH 4/7] Update the dump command to work with the registry Part of EZP-25598: eZSupportTools infocollector registry --- Command/SystemInfoDumpCommand.php | 65 ++++++++++++++++++++++++++++--- Resources/config/services.yml | 8 ++++ 2 files changed, 68 insertions(+), 5 deletions(-) diff --git a/Command/SystemInfoDumpCommand.php b/Command/SystemInfoDumpCommand.php index 323314ad..e0e1a484 100644 --- a/Command/SystemInfoDumpCommand.php +++ b/Command/SystemInfoDumpCommand.php @@ -8,13 +8,30 @@ */ namespace EzSystems\EzSupportToolsBundle\Command; +use EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector; +use EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class SystemInfoDumpCommand extends ContainerAwareCommand { + /** + * System info collector registry. + * + * @var \EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry + */ + private $registry; + + public function __construct(SystemInfoCollectorRegistry $registry) + { + $this->registry = $registry; + + parent::__construct(); + } + /** * Define command and input options. */ @@ -23,10 +40,22 @@ protected function configure() $this ->setName('ez-support-tools:dump-info') ->setDescription('Collects system information and dumps it.') + ->setHelp(<<<'EOD' +By default it dumps information from all available information collectors. +You can specify one or more collectors as arguments, e.g. 'php database hardware'. +To get a list if available collectors, use '--list-info-collectors' +EOD + ) + ->addOption( + 'list-info-collectors', + null, + InputOption::VALUE_NONE, + 'List all available information collectors, and exit.' + ) ->addArgument( - 'info-collector', - InputArgument::REQUIRED, - 'Which information collector should be used?' + 'info-collectors', + InputArgument::IS_ARRAY, + 'Which information collector(s) should be used? (separate multiple names with spaces)' ) ; } @@ -39,11 +68,37 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { - $infoCollector = $this->getContainer()->get($input->getArgument('info-collector')); + if ($input->getOption('list-info-collectors')) { + $output->writeln('Available info collectors:', true); + foreach ($this->registry->getIdentifiers() as $identifier) { + $output->writeln(" $identifier", true); + } + } else if ($identifiers = $input->getArgument('info-collectors')) { + foreach ($identifiers as $identifier) { + $this->outputInfo( + $this->registry->getItem($identifier), + $output + ); + } + } else { + foreach ($this->registry->getIdentifiers() as $identifier) { + $this->outputInfo($this->registry->getItem($identifier), $output); + } + } + } + + /** + * Output info collected by the given collector. + * + * @param $infoCollector SystemInfoCollector + * @param $output OutputInterface + */ + private function outputInfo(SystemInfoCollector $infoCollector, OutputInterface $output) + { $infoValue = $infoCollector->collect(); $outputArray = []; - // attributes() is deprecated, and getProperties() is protected. Smeg it, this is very temporary anyway. + // attributes() is deprecated, and getProperties() is protected. TODO add a toArray() or similar. foreach ($infoValue->attributes() as $property) { $outputArray[$property] = $infoValue->$property; } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 8839533e..a33960ed 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -2,6 +2,7 @@ imports: - { resource: view.yml } parameters: + support_tools.command.dump_info.class: EzSystems\EzSupportToolsBundle\Command\SystemInfoDumpCommand support_tools.info_collector.registry.class: EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased support_tools.info_collectors.composer.lock_file.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\JsonComposerLockSystemInfoCollector support_tools.info_collectors.database.doctrine.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\DoctrineDatabaseSystemInfoCollector @@ -10,6 +11,13 @@ parameters: support_tools.info_collectors.symfony.kernel.config.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\ConfigurationSymfonyKernelSystemInfoCollector services: + support_tools.command.dump_info: + class: %support_tools.command.dump_info.class% + arguments: + - @support_tools.info_collector.registry + tags: + - { name: console.command } + support_tools.info_collector.registry: class: %support_tools.info_collector.registry.class% From b9de1189d713109684d25b6dfb813a5fccdef958 Mon Sep 17 00:00:00 2001 From: Gunnstein Lye Date: Tue, 5 Apr 2016 13:51:07 +0200 Subject: [PATCH 5/7] Made the zeta ezcSysInfo factory lazy Done because the registry will run all collector constructors, so they should be lightweight. Part of EZP-25598: eZSupportTools infocollector registry --- Resources/config/services.yml | 7 ++++++- composer.json | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Resources/config/services.yml b/Resources/config/services.yml index a33960ed..9af00d36 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -4,6 +4,7 @@ imports: parameters: support_tools.command.dump_info.class: EzSystems\EzSupportToolsBundle\Command\SystemInfoDumpCommand support_tools.info_collector.registry.class: EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased + support_tools.info_collector.system_info.ezc.factory.class: EzSystems\EzSupportToolsBundle\SystemInfo\EzcSystemInfoFactory support_tools.info_collectors.composer.lock_file.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\JsonComposerLockSystemInfoCollector support_tools.info_collectors.database.doctrine.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\DoctrineDatabaseSystemInfoCollector support_tools.info_collectors.hardware.ezc.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\EzcHardwareSystemInfoCollector @@ -23,7 +24,11 @@ services: support_tools.info_collector.system_info.ezc: class: ezcSystemInfo - factory: [EzSystems\EzSupportToolsBundle\SystemInfo\EzcSystemInfoFactory, buildEzcSystemInfo] + factory: [@support_tools.info_collector.system_info.ezc.factory, buildEzcSystemInfo] + + support_tools.info_collector.system_info.ezc.factory: + class: %support_tools.info_collector.system_info.ezc.factory.class% + lazy: true support_tools.info_collectors.composer.lock_file: class: %support_tools.info_collectors.composer.lock_file.class% diff --git a/composer.json b/composer.json index 82ea0549..c3f6564c 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,8 @@ ], "require": { "ezsystems/ezpublish-kernel": "^6.2", + "ocramius/proxy-manager": "~1.0", + "symfony/proxy-manager-bridge": "*", "zetacomponents/system-information": "^1.1" }, "autoload": { From 476cbb3287b4cbf4bf681ff0d56d607e79747ac2 Mon Sep 17 00:00:00 2001 From: Gunnstein Lye Date: Wed, 6 Apr 2016 16:32:46 +0200 Subject: [PATCH 6/7] Improving eZSupportTools services naming Part of EZP-25598: eZSupportTools infocollector registry --- .../Compiler/SystemInfoCollectorPass.php | 8 +-- Resources/config/services.yml | 65 ++++++++++--------- Resources/config/view.yml | 2 +- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/DependencyInjection/Compiler/SystemInfoCollectorPass.php b/DependencyInjection/Compiler/SystemInfoCollectorPass.php index 906e3199..60ad4da7 100644 --- a/DependencyInjection/Compiler/SystemInfoCollectorPass.php +++ b/DependencyInjection/Compiler/SystemInfoCollectorPass.php @@ -21,20 +21,20 @@ class SystemInfoCollectorPass implements CompilerPassInterface */ public function process(ContainerBuilder $container) { - if (!$container->has('support_tools.info_collector.registry')) { + if (!$container->has('support_tools.system_info.collector_registry')) { return; } - $infoCollectorsTagged = $container->findTaggedServiceIds('support_tools.info_collector'); + $infoCollectorsTagged = $container->findTaggedServiceIds('support_tools.system_info.collector'); $infoCollectors = []; foreach ($infoCollectorsTagged as $id => $tags) { foreach ($tags as $attributes) { - $infoCollectors[$attributes['alias']] = new Reference($id); + $infoCollectors[$attributes['identifier']] = new Reference($id); } } - $infoCollectorRegistryDef = $container->findDefinition('support_tools.info_collector.registry'); + $infoCollectorRegistryDef = $container->findDefinition('support_tools.system_info.collector_registry'); $infoCollectorRegistryDef->setArguments([$infoCollectors]); } } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 9af00d36..f364c2da 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -3,65 +3,68 @@ imports: parameters: support_tools.command.dump_info.class: EzSystems\EzSupportToolsBundle\Command\SystemInfoDumpCommand - support_tools.info_collector.registry.class: EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased - support_tools.info_collector.system_info.ezc.factory.class: EzSystems\EzSupportToolsBundle\SystemInfo\EzcSystemInfoFactory - support_tools.info_collectors.composer.lock_file.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\JsonComposerLockSystemInfoCollector - support_tools.info_collectors.database.doctrine.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\DoctrineDatabaseSystemInfoCollector - support_tools.info_collectors.hardware.ezc.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\EzcHardwareSystemInfoCollector - support_tools.info_collectors.php.ezc.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\EzcPhpSystemInfoCollector - support_tools.info_collectors.symfony.kernel.config.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\ConfigurationSymfonyKernelSystemInfoCollector + support_tools.system_info.collector_registry.class: EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased + support_tools.system_info.ezc.factory.class: EzSystems\EzSupportToolsBundle\SystemInfo\EzcSystemInfoFactory + support_tools.system_info.collector.composer.lock_file.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\JsonComposerLockSystemInfoCollector + support_tools.system_info.collector.database.doctrine.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\DoctrineDatabaseSystemInfoCollector + support_tools.system_info.collector.hardware.ezc.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\EzcHardwareSystemInfoCollector + support_tools.system_info.collector.php.ezc.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\EzcPhpSystemInfoCollector + support_tools.system_info.collector.symfony.kernel.config.class: EzSystems\EzSupportToolsBundle\SystemInfo\Collector\ConfigurationSymfonyKernelSystemInfoCollector services: support_tools.command.dump_info: class: %support_tools.command.dump_info.class% arguments: - - @support_tools.info_collector.registry + - @support_tools.system_info.collector_registry tags: - { name: console.command } - support_tools.info_collector.registry: - class: %support_tools.info_collector.registry.class% + support_tools.system_info.collector_registry: + class: %support_tools.system_info.collector_registry.class% - support_tools.info_collector.system_info.ezc: + support_tools.system_info.ezc: class: ezcSystemInfo - factory: [@support_tools.info_collector.system_info.ezc.factory, buildEzcSystemInfo] + factory: [@support_tools.system_info.ezc.factory, buildEzcSystemInfo] - support_tools.info_collector.system_info.ezc.factory: - class: %support_tools.info_collector.system_info.ezc.factory.class% + support_tools.system_info.ezc.factory: + class: %support_tools.system_info.ezc.factory.class% lazy: true - support_tools.info_collectors.composer.lock_file: - class: %support_tools.info_collectors.composer.lock_file.class% + + # SystemInfoCollectors + + support_tools.system_info.collector.composer.lock_file: + class: %support_tools.system_info.collector.composer.lock_file.class% arguments: - "%kernel.root_dir%/../composer.lock" tags: - - { name: "support_tools.info_collector", alias: "composer" } + - { name: "support_tools.system_info.collector", identifier: "composer" } - support_tools.info_collectors.database.doctrine: - class: %support_tools.info_collectors.database.doctrine.class% + support_tools.system_info.collector.database.doctrine: + class: %support_tools.system_info.collector.database.doctrine.class% arguments: - @database_connection tags: - - { name: "support_tools.info_collector", alias: "database" } + - { name: "support_tools.system_info.collector", identifier: "database" } - support_tools.info_collectors.hardware.ezc: - class: %support_tools.info_collectors.hardware.ezc.class% + support_tools.system_info.collector.hardware.ezc: + class: %support_tools.system_info.collector.hardware.ezc.class% arguments: - - @support_tools.info_collector.system_info.ezc + - @support_tools.system_info.ezc tags: - - { name: "support_tools.info_collector", alias: "hardware" } + - { name: "support_tools.system_info.collector", identifier: "hardware" } - support_tools.info_collectors.php.ezc: - class: %support_tools.info_collectors.php.ezc.class% + support_tools.system_info.collector.php.ezc: + class: %support_tools.system_info.collector.php.ezc.class% arguments: - - @support_tools.info_collector.system_info.ezc + - @support_tools.system_info.ezc tags: - - { name: "support_tools.info_collector", alias: "php" } + - { name: "support_tools.system_info.collector", identifier: "php" } - support_tools.info_collectors.symfony.kernel.config: - class: %support_tools.info_collectors.symfony.kernel.config.class% + support_tools.system_info.collector.symfony.kernel.config: + class: %support_tools.system_info.collector.symfony.kernel.config.class% arguments: - @kernel - %kernel.bundles% tags: - - { name: "support_tools.info_collector", alias: "symfony_kernel" } + - { name: "support_tools.system_info.collector", identifier: "symfony_kernel" } diff --git a/Resources/config/view.yml b/Resources/config/view.yml index 782f371b..d1011e2f 100644 --- a/Resources/config/view.yml +++ b/Resources/config/view.yml @@ -3,7 +3,7 @@ services: class: EzSystems\EzSupportToolsBundle\View\SystemInfoViewBuilder arguments: - @ezpublish.view.configurator - - @support_tools.info_collector.registry + - @support_tools.system_info.collector_registry support_tools.view.controller: class: EzSystems\EzSupportToolsBundle\Controller\SystemInfoController From c131db89a3f7129b4dfad418eb07df6cda0576e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20R?= Date: Thu, 7 Apr 2016 10:20:46 +0200 Subject: [PATCH 7/7] Update .travis.yml --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec93931c..f856730c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,10 +11,14 @@ branches: - master before_script: - - composer selfupdate - - composer install --prefer-dist + # re-enable when / if coverage is disabled for faster test runs + #- phpenv config-rm xdebug.ini + - travis_retry composer selfupdate + # Avoid memory issues on composer install + - echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - travis_retry composer install --prefer-dist --no-interaction -script: phpunit --coverage-text +script: php bin/phpunit --coverage-text notifications: email: false