7
7
8
8
use Magento \Framework \Component \ComponentRegistrar ;
9
9
use Magento \Setup \Console \Command \DiCompileCommand ;
10
+ use Magento \Setup \Module \Di \App \Task \OperationFactory ;
10
11
use Symfony \Component \Console \Tester \CommandTester ;
11
12
12
13
/**
@@ -61,6 +62,10 @@ public function setUp()
61
62
$ this ->managerMock = $ this ->createMock (\Magento \Setup \Module \Di \App \Task \Manager::class);
62
63
$ this ->directoryListMock =
63
64
$ this ->createMock (\Magento \Framework \App \Filesystem \DirectoryList::class);
65
+ $ this ->directoryListMock ->expects ($ this ->any ())->method ('getPath ' )->willReturnMap ([
66
+ [\Magento \Framework \App \Filesystem \DirectoryList::SETUP , '/path (1)/to/setup/ ' ],
67
+ ]);
68
+
64
69
$ this ->filesystemMock = $ this ->getMockBuilder (\Magento \Framework \Filesystem::class)
65
70
->disableOriginalConstructor ()
66
71
->getMock ();
@@ -70,8 +75,8 @@ public function setUp()
70
75
->getMock ();
71
76
$ this ->componentRegistrarMock = $ this ->createMock (\Magento \Framework \Component \ComponentRegistrar::class);
72
77
$ this ->componentRegistrarMock ->expects ($ this ->any ())->method ('getPaths ' )->willReturnMap ([
73
- [ComponentRegistrar::MODULE , ['/path/to/module/one ' , '/path/to/module/two ' ]],
74
- [ComponentRegistrar::LIBRARY , ['/path/to/library/one ' , '/path/to/library/two ' ]],
78
+ [ComponentRegistrar::MODULE , ['/path/to/module/one ' , '/path (1) /to/module/two ' ]],
79
+ [ComponentRegistrar::LIBRARY , ['/path/to/library/one ' , '/path (1) /to/library/two ' ]],
75
80
]);
76
81
77
82
$ this ->command = new DiCompileCommand (
@@ -128,7 +133,28 @@ public function testExecute()
128
133
->method ('create ' )
129
134
->with (\Symfony \Component \Console \Helper \ProgressBar::class)
130
135
->willReturn ($ progressBar );
131
- $ this ->managerMock ->expects ($ this ->exactly (7 ))->method ('addOperation ' );
136
+
137
+ $ this ->managerMock ->expects ($ this ->exactly (7 ))->method ('addOperation ' )
138
+ ->withConsecutive (
139
+ [OperationFactory::PROXY_GENERATOR , []],
140
+ [OperationFactory::REPOSITORY_GENERATOR , $ this ->anything ()],
141
+ [OperationFactory::DATA_ATTRIBUTES_GENERATOR , []],
142
+ [OperationFactory::APPLICATION_CODE_GENERATOR , $ this ->callback (function ($ subject ) {
143
+ $ this ->assertEmpty (array_diff ($ subject ['excludePatterns ' ], [
144
+ "#^(?:/path \(1\)/to/setup/)(/[\w]+)*/Test# " ,
145
+ "#^(?:/path/to/library/one|/path \(1\)/to/library/two)/([\w]+/)?Test# " ,
146
+ "#^(?:/path/to/library/one|/path \(1\)/to/library/two)/([\w]+/)?tests# " ,
147
+ "#^(?:/path/to/(?:module/(?:one))|/path \(1\)/to/(?:module/(?:two)))/Test# " ,
148
+ "#^(?:/path/to/(?:module/(?:one))|/path \(1\)/to/(?:module/(?:two)))/tests# "
149
+ ]));
150
+ return true ;
151
+ })],
152
+ [OperationFactory::INTERCEPTION , $ this ->anything ()],
153
+ [OperationFactory::AREA_CONFIG_GENERATOR , $ this ->anything ()],
154
+ [OperationFactory::INTERCEPTION_CACHE , $ this ->anything ()]
155
+ )
156
+ ;
157
+
132
158
$ this ->managerMock ->expects ($ this ->once ())->method ('process ' );
133
159
$ tester = new CommandTester ($ this ->command );
134
160
$ tester ->execute ([]);
0 commit comments