8 use Symfony\Component\Console\Tester\CommandTester;
20 private $commandTester;
25 'Magento_A' =>
__DIR__ .
'/_files/root/app/code/Magento/A',
26 'Magento_B' =>
__DIR__ .
'/_files/root/app/code/Magento/B' 28 $objectManagerProvider = $this->createMock(\
Magento\Setup\Model\ObjectManagerProvider::class);
30 $objectManagerProvider->expects($this->once())->method(
'get')->willReturn(
$objectManager);
32 $themePackageListMock = $this->createMock(\
Magento\Framework\
View\Design\Theme\ThemePackageList::class);
33 $componentRegistrarMock = $this->createMock(\
Magento\Framework\Component\ComponentRegistrar::class);
34 $componentRegistrarMock->expects($this->any())->method(
'getPaths')->will($this->returnValue($modules));
35 $dirSearchMock = $this->createMock(\
Magento\Framework\Component\DirSearch::class);
36 $dirSearchMock->expects($this->once())->method(
'collectFiles')->willReturn(
38 __DIR__ .
'/_files/root/app/code/Magento/A/etc/module.xml',
39 __DIR__ .
'/_files/root/app/code/Magento/B/etc/module.xml' 42 $objectManager->expects($this->any())->method(
'get')->will($this->returnValueMap([
43 [\
Magento\Framework\
View\Design\Theme\ThemePackageList::class, $themePackageListMock],
44 [\
Magento\Framework\Component\ComponentRegistrar::class, $componentRegistrarMock],
45 [\
Magento\Framework\Component\DirSearch::class, $dirSearchMock]
49 $this->commandTester =
new CommandTester($this->command);
54 if (file_exists(
__DIR__ .
'/_files/output/framework.csv')) {
61 $this->commandTester->execute(
62 [
'--output' =>
__DIR__ .
'/_files/output/framework.csv']
64 $this->assertEquals(
'Report successfully processed.' . PHP_EOL, $this->commandTester->getDisplay());
66 $this->assertContains(
67 '"Dependencies of framework:","Total number"' . PHP_EOL .
',2' . PHP_EOL,
70 $this->assertContains(
'"Dependencies for each module:",' . PHP_EOL, $fileContents);
71 $this->assertContains(
'"Magento\A",1' . PHP_EOL .
'" -- Magento\Framework",2' . PHP_EOL, $fileContents);
72 $this->assertContains(
'"Magento\B",1' . PHP_EOL .
'" -- Magento\Framework",2' . PHP_EOL, $fileContents);
defined('TESTS_BP')||define('TESTS_BP' __DIR__