9 use Symfony\Component\Console\Tester\CommandTester;
21 private $commandTester;
27 'Magento_A' =>
__DIR__ .
'/_files/root/app/code/Magento/A',
28 'Magento_B' =>
__DIR__ .
'/_files/root/app/code/Magento/B' 31 $objectManagerProvider = $this->createMock(\
Magento\Setup\Model\ObjectManagerProvider::class);
33 $objectManagerProvider->expects($this->once())->method(
'get')->willReturn(
$objectManager);
35 $themePackageListMock = $this->createMock(\
Magento\Framework\
View\Design\Theme\ThemePackageList::class);
36 $componentRegistrarMock = $this->createMock(\
Magento\Framework\Component\ComponentRegistrar::class);
37 $componentRegistrarMock->expects($this->any())->method(
'getPaths')->will($this->returnValue($modules));
38 $dirSearchMock = $this->createMock(\
Magento\Framework\Component\DirSearch::class);
39 $objectManager->expects($this->any())->method(
'get')->will($this->returnValueMap([
40 [\
Magento\Framework\
View\Design\Theme\ThemePackageList::class, $themePackageListMock],
41 [\
Magento\Framework\Component\ComponentRegistrar::class, $componentRegistrarMock],
42 [\
Magento\Framework\Component\DirSearch::class, $dirSearchMock]
46 $this->commandTester =
new CommandTester($this->command);
51 if (file_exists(
__DIR__ .
'/_files/output/modules.csv')) {
58 $this->commandTester->execute(
59 [
'--output' =>
__DIR__ .
'/_files/output/modules.csv']
61 $this->assertEquals(
'Report successfully processed.' . PHP_EOL, $this->commandTester->getDisplay());
63 $this->assertContains(
64 ',All,Hard,Soft' . PHP_EOL .
'"Total number of dependencies",2,2,0' . PHP_EOL,
67 $this->assertContains(
'"Dependencies for each module:",All,Hard,Soft'. PHP_EOL, $fileContents);
68 $this->assertContains(
69 'magento/module-a,1,1,0' . PHP_EOL .
'" -- magento/module-b",,1,0' . PHP_EOL,
72 $this->assertContains(
73 'magento/module-b,1,1,0' . PHP_EOL .
'" -- magento/module-a",,1,0' . PHP_EOL,
defined('TESTS_BP')||define('TESTS_BP' __DIR__