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
class DiCompileCommandTest extends \PHPUnit_Framework_TestCase
@@ -63,6 +64,9 @@ public function setUp()
63
64
->willReturn ($ this ->objectManagerMock );
64
65
$ this ->managerMock = $ this ->getMock ('Magento\Setup\Module\Di\App\Task\Manager ' , [], [], '' , false );
65
66
$ this ->directoryListMock = $ this ->getMock ('Magento\Framework\App\Filesystem\DirectoryList ' , [], [], '' , false );
67
+ $ this ->directoryListMock ->expects ($ this ->any ())->method ('getPath ' )->willReturnMap ([
68
+ [\Magento \Framework \App \Filesystem \DirectoryList::SETUP , '/path (1)/to/setup/ ' ],
69
+ ]);
66
70
$ this ->filesystemMock = $ this ->getMockBuilder ('Magento\Framework\Filesystem ' )
67
71
->disableOriginalConstructor ()
68
72
->getMock ();
@@ -78,8 +82,8 @@ public function setUp()
78
82
false
79
83
);
80
84
$ this ->componentRegistrarMock ->expects ($ this ->any ())->method ('getPaths ' )->willReturnMap ([
81
- [ComponentRegistrar::MODULE , ['/path/to/module/one ' , '/path/to/module/two ' ]],
82
- [ComponentRegistrar::LIBRARY , ['/path/to/library/one ' , '/path/to/library/two ' ]],
85
+ [ComponentRegistrar::MODULE , ['/path/to/module/one ' , '/path (1) /to/module/two ' ]],
86
+ [ComponentRegistrar::LIBRARY , ['/path/to/library/one ' , '/path (1) /to/library/two ' ]],
83
87
]);
84
88
85
89
$ this ->command = new DiCompileCommand (
@@ -136,7 +140,28 @@ public function testExecute()
136
140
->method ('create ' )
137
141
->with ('Symfony\Component\Console\Helper\ProgressBar ' )
138
142
->willReturn ($ progressBar );
139
- $ this ->managerMock ->expects ($ this ->exactly (7 ))->method ('addOperation ' );
143
+
144
+ $ this ->managerMock ->expects ($ this ->exactly (7 ))->method ('addOperation ' )
145
+ ->withConsecutive (
146
+ [OperationFactory::PROXY_GENERATOR , []],
147
+ [OperationFactory::REPOSITORY_GENERATOR , $ this ->anything ()],
148
+ [OperationFactory::DATA_ATTRIBUTES_GENERATOR , []],
149
+ [OperationFactory::APPLICATION_CODE_GENERATOR , $ this ->callback (function ($ subject ) {
150
+ $ this ->assertEmpty (array_diff ($ subject ['excludePatterns ' ], [
151
+ "#^(?:/path \(1\)/to/setup/)(/[\w]+)*/Test# " ,
152
+ "#^(?:/path/to/library/one|/path \(1\)/to/library/two)/([\w]+/)?Test# " ,
153
+ "#^(?:/path/to/library/one|/path \(1\)/to/library/two)/([\w]+/)?tests# " ,
154
+ "#^(?:/path/to/(?:module/(?:one))|/path \(1\)/to/(?:module/(?:two)))/Test# " ,
155
+ "#^(?:/path/to/(?:module/(?:one))|/path \(1\)/to/(?:module/(?:two)))/tests# "
156
+ ]));
157
+ return true ;
158
+ })],
159
+ [OperationFactory::INTERCEPTION , $ this ->anything ()],
160
+ [OperationFactory::AREA_CONFIG_GENERATOR , $ this ->anything ()],
161
+ [OperationFactory::INTERCEPTION_CACHE , $ this ->anything ()]
162
+ )
163
+ ;
164
+
140
165
$ this ->managerMock ->expects ($ this ->once ())->method ('process ' );
141
166
$ tester = new CommandTester ($ this ->command );
142
167
$ tester ->execute ([]);
0 commit comments