From 42bf1f258f6bb46d960932bcb30d1f96271991bb Mon Sep 17 00:00:00 2001
From: Eddie Lau <kahlau@ebay.com>
Date: Wed, 29 Apr 2015 17:37:42 -0500
Subject: [PATCH] MAGETWO-36071: Move
 dev/tools/Magento/Tools/Dependency/generate/*.dependencies.php tools

- added integration tests
- added output option for commands
---
 .../etc/install-config-mysql.php.dist         |  2 +-
 .../DependenciesShowFrameworkCommandTest.php  | 56 +++++++++++++++++++
 ...ndenciesShowModulesCircularCommandTest.php | 56 +++++++++++++++++++
 .../DependenciesShowModulesCommandTest.php    | 56 +++++++++++++++++++
 .../Command/_files/expected/circular.csv      |  9 +++
 .../Command/_files/expected/framework.csv     |  9 +++
 .../Command/_files/expected/modules.csv       |  9 +++
 .../Console/Command/_files/output/.gitignore  |  0
 .../root/app/code/Magento/A/Model/Foo.php     | 14 +++++
 .../root/app/code/Magento/A/composer.json     | 10 ++++
 .../root/app/code/Magento/A/etc/module.xml    | 14 +++++
 .../root/app/code/Magento/B/Model/Foo.php     | 14 +++++
 .../root/app/code/Magento/B/composer.json     | 10 ++++
 .../root/app/code/Magento/B/etc/module.xml    | 14 +++++
 .../Command/AbstractDependenciesCommand.php   | 26 ++++++++-
 .../DependenciesShowFrameworkCommand.php      | 15 ++++-
 ...DependenciesShowModulesCircularCommand.php | 15 ++++-
 .../DependenciesShowModulesCommand.php        | 15 ++++-
 .../Tools/Dependency/ServiceLocator.php       |  2 +-
 19 files changed, 335 insertions(+), 11 deletions(-)
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowFrameworkCommandTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowModulesCircularCommandTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowModulesCommandTest.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/circular.csv
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/framework.csv
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/modules.csv
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/output/.gitignore
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/Model/Foo.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/composer.json
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/etc/module.xml
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/Model/Foo.php
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/composer.json
 create mode 100644 dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/etc/module.xml

diff --git a/dev/tests/integration/etc/install-config-mysql.php.dist b/dev/tests/integration/etc/install-config-mysql.php.dist
index 0d8fb591eb1..975ad9c0be4 100644
--- a/dev/tests/integration/etc/install-config-mysql.php.dist
+++ b/dev/tests/integration/etc/install-config-mysql.php.dist
@@ -7,7 +7,7 @@
 return [
     'db_host' => 'localhost',
     'db_user' => 'root',
-    'db_password' => '',
+    'db_password' => 'root',
     'db_name' => 'magento_integration_tests',
     'db_prefix' => '',
     'backend_frontname' => 'backend',
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowFrameworkCommandTest.php b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowFrameworkCommandTest.php
new file mode 100644
index 00000000000..9e73b16468a
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowFrameworkCommandTest.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Test\Tool\Console\Command;
+
+use Magento\Tools\Console\Command\DependenciesShowFrameworkCommand;
+use Symfony\Component\Console\Tester\CommandTester;
+
+class DependenciesShowFrameworkCommandTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var DependenciesShowFrameworkCommand
+     */
+    private $command;
+
+    /**
+     * @var CommandTester
+     */
+    private $commandTester;
+
+    public function setUp()
+    {
+        $this->command = new DependenciesShowFrameworkCommand();
+        $this->commandTester = new CommandTester($this->command);
+    }
+
+    public function tearDown()
+    {
+        if (file_exists(__DIR__ . '/_files/output/framework.csv')) {
+            unlink(__DIR__ . '/_files/output/framework.csv');
+        }
+    }
+
+    public function testExecute()
+    {
+        $this->commandTester->execute(
+            ['--directory' => __DIR__ . '/_files/root', '--output' => __DIR__ . '/_files/output/framework.csv']
+        );
+        $this->assertEquals('Report successfully processed.' . PHP_EOL , $this->commandTester->getDisplay());
+        $this->assertFileEquals(
+            __DIR__ . '/_files/expected/framework.csv',
+            __DIR__ . '/_files/output/framework.csv'
+        );
+    }
+
+    public function testExecuteInvalidDirectory()
+    {
+        $this->commandTester->execute(['--directory' => '/invalid/path']);
+        $this->assertContains(
+            'Please, check passed path. Dependencies report generator failed:',
+            $this->commandTester->getDisplay()
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowModulesCircularCommandTest.php b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowModulesCircularCommandTest.php
new file mode 100644
index 00000000000..914faeeaef9
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowModulesCircularCommandTest.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Test\Tool\Console\Command;
+
+use Magento\Tools\Console\Command\DependenciesShowModulesCircularCommand;
+use Symfony\Component\Console\Tester\CommandTester;
+
+class DependenciesShowModulesCircularCommandTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var DependenciesShowModulesCircularCommand
+     */
+    private $command;
+
+    /**
+     * @var CommandTester
+     */
+    private $commandTester;
+
+    public function setUp()
+    {
+        $this->command = new DependenciesShowModulesCircularCommand();
+        $this->commandTester = new CommandTester($this->command);
+    }
+
+    public function tearDown()
+    {
+        if (file_exists(__DIR__ . '/_files/output/circular.csv')) {
+            unlink(__DIR__ . '/_files/output/circular.csv');
+        }
+    }
+
+    public function testExecute()
+    {
+        $this->commandTester->execute(
+            ['--directory' => __DIR__ . '/_files/root', '--output' => __DIR__ . '/_files/output/circular.csv']
+        );
+        $this->assertEquals('Report successfully processed.' . PHP_EOL , $this->commandTester->getDisplay());
+        $this->assertFileEquals(
+            __DIR__ . '/_files/expected/circular.csv',
+            __DIR__ . '/_files/output/circular.csv'
+        );
+    }
+
+    public function testExecuteInvalidDirectory()
+    {
+        $this->commandTester->execute(['--directory' => '/invalid/path']);
+        $this->assertContains(
+            'Please, check passed path. Dependencies report generator failed:',
+            $this->commandTester->getDisplay()
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowModulesCommandTest.php b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowModulesCommandTest.php
new file mode 100644
index 00000000000..4b9f0fcca27
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/DependenciesShowModulesCommandTest.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Test\Tool\Console\Command;
+
+use Magento\Tools\Console\Command\DependenciesShowModulesCommand;
+use Symfony\Component\Console\Tester\CommandTester;
+
+class DependenciesShowModulesCommandTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var DependenciesShowModulesCommand
+     */
+    private $command;
+
+    /**
+     * @var CommandTester
+     */
+    private $commandTester;
+
+    public function setUp()
+    {
+        $this->command = new DependenciesShowModulesCommand();
+        $this->commandTester = new CommandTester($this->command);
+    }
+
+    public function tearDown()
+    {
+        if (file_exists(__DIR__ . '/_files/output/modules.csv')) {
+            unlink(__DIR__ . '/_files/output/modules.csv');
+        }
+    }
+
+    public function testExecute()
+    {
+        $this->commandTester->execute(
+            ['--directory' => __DIR__ . '/_files/root', '--output' => __DIR__ . '/_files/output/modules.csv']
+        );
+        $this->assertEquals('Report successfully processed.' . PHP_EOL , $this->commandTester->getDisplay());
+        $this->assertFileEquals(
+            __DIR__ . '/_files/expected/modules.csv',
+            __DIR__ . '/_files/output/modules.csv'
+        );
+    }
+
+    public function testExecuteInvalidDirectory()
+    {
+        $this->commandTester->execute(['--directory' => '/invalid/path']);
+        $this->assertContains(
+            'Please, check passed path. Dependencies report generator failed:',
+            $this->commandTester->getDisplay()
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/circular.csv b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/circular.csv
new file mode 100644
index 00000000000..6d00c9f4815
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/circular.csv
@@ -0,0 +1,9 @@
+"Circular dependencies:","Total number of chains"
+"","2"
+
+"Circular dependencies for each module:",""
+"magento/module-a","1"
+"magento/module-a->magento/module-b->magento/module-a"
+
+"magento/module-b","1"
+"magento/module-b->magento/module-a->magento/module-b"
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/framework.csv b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/framework.csv
new file mode 100644
index 00000000000..b6abb23cd68
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/framework.csv
@@ -0,0 +1,9 @@
+"Dependencies of framework:","Total number"
+"","2"
+
+"Dependencies for each module:",""
+"Magento\A","1"
+" -- Magento\Framework","1"
+
+"Magento\B","1"
+" -- Magento\Framework","1"
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/modules.csv b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/modules.csv
new file mode 100644
index 00000000000..41deca9466e
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/expected/modules.csv
@@ -0,0 +1,9 @@
+"","All","Hard","Soft"
+"Total number of dependencies","2","2","0"
+
+"Dependencies for each module:","All","Hard","Soft"
+"magento/module-a","1","1","0"
+" -- magento/module-b","","1","0"
+
+"magento/module-b","1","1","0"
+" -- magento/module-a","","1","0"
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/output/.gitignore b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/output/.gitignore
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/Model/Foo.php b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/Model/Foo.php
new file mode 100644
index 00000000000..f09ea608523
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/Model/Foo.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\A\Model;
+
+class Foo
+{
+    public function foo()
+    {
+        $frameworkDependencies = new \Magento\Framework\A();
+    }
+}
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/composer.json b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/composer.json
new file mode 100644
index 00000000000..a5e72e273a3
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/composer.json
@@ -0,0 +1,10 @@
+{
+    "name": "magento/module-a",
+    "require": {
+        "php": "~5.5.0|~5.6.0",
+        "magento/framework": "0.1",
+        "magento/magento-composer-installer": "*",
+        "magento/module-b": "0.1"
+    },
+    "version": "0.1"
+}
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/etc/module.xml b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/etc/module.xml
new file mode 100644
index 00000000000..dd60aeb295b
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/A/etc/module.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
+    <module name="Magento_AdminNotification" setup_version="2.0.0">
+        <sequence>
+            <module name="Magento_Store"/>
+        </sequence>
+    </module>
+</config>
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/Model/Foo.php b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/Model/Foo.php
new file mode 100644
index 00000000000..b42c3197030
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/Model/Foo.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\B\Model;
+
+class Foo
+{
+    public function foo()
+    {
+        $frameworkDependencies = new \Magento\Framework\B();
+    }
+}
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/composer.json b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/composer.json
new file mode 100644
index 00000000000..3d25220200c
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/composer.json
@@ -0,0 +1,10 @@
+{
+    "name": "magento/module-b",
+    "require": {
+        "php": "~5.5.0|~5.6.0",
+        "magento/framework": "0.74.0-beta6",
+        "magento/magento-composer-installer": "*",
+        "magento/module-a": "0.1"
+    },
+    "version": "0.1"
+}
diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/etc/module.xml b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/etc/module.xml
new file mode 100644
index 00000000000..6c30cdc5c72
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Console/Command/_files/root/app/code/Magento/B/etc/module.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
+    <module name="Magento_Authorization" setup_version="2.0.0">
+        <sequence>
+            <module name="Magento_Backend"/>
+        </sequence>
+    </module>
+</config>
diff --git a/dev/tools/Magento/Tools/Console/Command/AbstractDependenciesCommand.php b/dev/tools/Magento/Tools/Console/Command/AbstractDependenciesCommand.php
index da55debb00b..51649929b7a 100644
--- a/dev/tools/Magento/Tools/Console/Command/AbstractDependenciesCommand.php
+++ b/dev/tools/Magento/Tools/Console/Command/AbstractDependenciesCommand.php
@@ -18,6 +18,11 @@ abstract class AbstractDependenciesCommand extends Command
      */
     const INPUT_KEY_DIRECTORY = 'directory';
 
+    /**
+     * Input key for output path of report file
+     */
+    const INPUT_KEY_OUTPUT = 'output';
+
     /**
      * {@inheritdoc}
      */
@@ -30,6 +35,13 @@ abstract class AbstractDependenciesCommand extends Command
                     InputOption::VALUE_REQUIRED,
                     'Path to base directory for parsing',
                     BP
+                ),
+                new InputOption(
+                    self::INPUT_KEY_OUTPUT,
+                    'o',
+                    InputOption::VALUE_REQUIRED,
+                    'Path to report file',
+                    $this->getDefaultOutputPath()
                 )
             ]
         );
@@ -39,9 +51,17 @@ abstract class AbstractDependenciesCommand extends Command
     /**
      * Build dependencies report
      *
+     * @param string $outputPath
      * @return void
      */
-    abstract protected function buildReport();
+    abstract protected function buildReport($outputPath);
+
+    /**
+     * Get path to the default output report file
+     *
+     * @return string
+     */
+    abstract protected function getDefaultOutputPath();
 
     /**
      * {@inheritdoc}
@@ -49,8 +69,8 @@ abstract class AbstractDependenciesCommand extends Command
     protected function execute(InputInterface $input, OutputInterface $output)
     {
         try {
-            Files::setInstance(new \Magento\Framework\App\Utility\Files($input->getOption(self::INPUT_KEY_DIRECTORY)));
-            $this->buildReport();
+            Files::setInstance(new Files($input->getOption(self::INPUT_KEY_DIRECTORY)));
+            $this->buildReport($input->getOption(self::INPUT_KEY_OUTPUT));
             $output->writeln('<info>Report successfully processed.</info>');
         } catch (\Exception $e) {
             $output->writeln(
diff --git a/dev/tools/Magento/Tools/Console/Command/DependenciesShowFrameworkCommand.php b/dev/tools/Magento/Tools/Console/Command/DependenciesShowFrameworkCommand.php
index 9dc7ff43f46..87306ba0f99 100644
--- a/dev/tools/Magento/Tools/Console/Command/DependenciesShowFrameworkCommand.php
+++ b/dev/tools/Magento/Tools/Console/Command/DependenciesShowFrameworkCommand.php
@@ -23,12 +23,23 @@ class DependenciesShowFrameworkCommand extends AbstractDependenciesCommand
         parent::configure();
     }
 
+    /**
+     * Return default output file for framework dependencies report
+     *
+     * @return string
+     */
+    protected function getDefaultOutputPath()
+    {
+        return 'framework-dependencies.csv';
+    }
+
     /**
      * Build Framework dependencies report
      *
+     * @param string $outputPath
      * @return void
      */
-    protected function buildReport()
+    protected function buildReport($outputPath)
     {
         $filesForParse = Files::init()->getFiles([Files::init()->getPathToSource() . '/app/code/Magento'], '*');
         $configFiles = Files::init()->getConfigFiles('module.xml', [], false);
@@ -40,7 +51,7 @@ class DependenciesShowFrameworkCommand extends AbstractDependenciesCommand
                     'config_files' => $configFiles,
                     'declared_namespaces' => Files::init()->getNamespaces(),
                 ],
-                'write' => ['report_filename' => 'framework-dependencies.csv'],
+                'write' => ['report_filename' => $outputPath],
             ]
         );
     }
diff --git a/dev/tools/Magento/Tools/Console/Command/DependenciesShowModulesCircularCommand.php b/dev/tools/Magento/Tools/Console/Command/DependenciesShowModulesCircularCommand.php
index 10ac41906e4..11916895c0e 100644
--- a/dev/tools/Magento/Tools/Console/Command/DependenciesShowModulesCircularCommand.php
+++ b/dev/tools/Magento/Tools/Console/Command/DependenciesShowModulesCircularCommand.php
@@ -23,19 +23,30 @@ class DependenciesShowModulesCircularCommand extends AbstractDependenciesCommand
         parent::configure();
     }
 
+    /**
+     * Return default output file for modules circular dependencies report
+     *
+     * @return string
+     */
+    protected function getDefaultOutputPath()
+    {
+        return 'modules-circular-dependencies.csv';
+    }
+
     /**
      * Build circular dependencies between modules report
      *
+     * @param string $outputPath
      * @return void
      */
-    protected function buildReport()
+    protected function buildReport($outputPath)
     {
         $filesForParse = Files::init()->getComposerFiles('code', false);
 
         ServiceLocator::getCircularDependenciesReportBuilder()->build(
             [
                 'parse' => ['files_for_parse' => $filesForParse],
-                'write' => ['report_filename' => 'modules-circular-dependencies.csv'],
+                'write' => ['report_filename' => $outputPath],
             ]
         );
     }
diff --git a/dev/tools/Magento/Tools/Console/Command/DependenciesShowModulesCommand.php b/dev/tools/Magento/Tools/Console/Command/DependenciesShowModulesCommand.php
index 838327d0d47..31aacdb259f 100644
--- a/dev/tools/Magento/Tools/Console/Command/DependenciesShowModulesCommand.php
+++ b/dev/tools/Magento/Tools/Console/Command/DependenciesShowModulesCommand.php
@@ -23,19 +23,30 @@ class DependenciesShowModulesCommand extends AbstractDependenciesCommand
         parent::configure();
     }
 
+    /**
+     * Return default output file for modules dependencies report
+     *
+     * @return string
+     */
+    protected function getDefaultOutputPath()
+    {
+        return 'modules-dependencies.csv';
+    }
+
     /**
      * Build circular dependencies between modules report
      *
+     * @param string $outputPath
      * @return void
      */
-    protected function buildReport()
+    protected function buildReport($outputPath)
     {
         $filesForParse = Files::init()->getComposerFiles('code', false);
 
         ServiceLocator::getDependenciesReportBuilder()->build(
             [
                 'parse' => ['files_for_parse' => $filesForParse],
-                'write' => ['report_filename' => 'modules-dependencies.csv'],
+                'write' => ['report_filename' => $outputPath],
             ]
         );
     }
diff --git a/dev/tools/Magento/Tools/Dependency/ServiceLocator.php b/dev/tools/Magento/Tools/Dependency/ServiceLocator.php
index eb442748065..16ce14b9ae2 100644
--- a/dev/tools/Magento/Tools/Dependency/ServiceLocator.php
+++ b/dev/tools/Magento/Tools/Dependency/ServiceLocator.php
@@ -164,7 +164,7 @@ class ServiceLocator
     private static function getCsvWriter()
     {
         if (null === self::$csvWriter) {
-            self::$csvWriter = (new Csv())->setDelimiter(';');
+            self::$csvWriter = (new Csv())->setDelimiter(',');
         }
         return self::$csvWriter;
     }
-- 
GitLab