12
12
use Symfony \Component \Console \Helper \TableHelper ;
13
13
use Magento \Store \Model \Website ;
14
14
use Magento \Framework \Console \Cli ;
15
- use Magento \Framework \Mview \View \CollectionFactory ;
16
15
17
16
/**
18
17
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -46,15 +45,9 @@ protected function setUp()
46
45
$ isLoadedProperty ->setAccessible (true );
47
46
$ isLoadedProperty ->setValue ($ this ->collection , true );
48
47
49
- $ collectionFactory = $ this ->getMockBuilder (CollectionFactory::class)
50
- ->disableOriginalConstructor ()
51
- ->getMock ();
52
- $ collectionFactory ->method ('create ' )
53
- ->willReturn ($ this ->collection );
54
-
55
48
$ this ->command = $ this ->objectManager ->getObject (
56
49
IndexerStatusMviewCommand::class,
57
- ['collectionFactory ' => $ collectionFactory ]
50
+ ['collection ' => $ this -> collection ]
58
51
);
59
52
60
53
/** @var HelperSet $helperSet */
@@ -73,8 +66,6 @@ public function testExecute()
73
66
[
74
67
'view ' => [
75
68
'view_id ' => 'catalog_category_product ' ,
76
- ],
77
- 'state ' => [
78
69
'mode ' => 'enabled ' ,
79
70
'status ' => 'idle ' ,
80
71
'updated ' => '2017-01-01 11:11:11 ' ,
@@ -87,8 +78,6 @@ public function testExecute()
87
78
[
88
79
'view ' => [
89
80
'view_id ' => 'catalog_product_category ' ,
90
- ],
91
- 'state ' => [
92
81
'mode ' => 'disabled ' ,
93
82
'status ' => 'idle ' ,
94
83
'updated ' => '2017-01-01 11:11:11 ' ,
@@ -101,8 +90,6 @@ public function testExecute()
101
90
[
102
91
'view ' => [
103
92
'view_id ' => 'catalog_product_attribute ' ,
104
- ],
105
- 'state ' => [
106
93
'mode ' => 'enabled ' ,
107
94
'status ' => 'idle ' ,
108
95
'updated ' => '2017-01-01 11:11:11 ' ,
@@ -115,7 +102,7 @@ public function testExecute()
115
102
];
116
103
117
104
foreach ($ mviews as $ data ) {
118
- $ this ->collection ->addItem ($ this ->generateMviewStub ($ data ['view ' ], $ data ['changelog ' ], $ data [ ' state ' ] ));
105
+ $ this ->collection ->addItem ($ this ->generateMviewStub ($ data ['view ' ], $ data ['changelog ' ]));
119
106
}
120
107
$ this ->collection ->addItem ($ this ->getNeverEnabledMviewIndexerWithNoTable ());
121
108
@@ -166,19 +153,18 @@ public function testExecute()
166
153
/**
167
154
* @param array $viewData
168
155
* @param array $changelogData
169
- * @param array $stateData
170
156
* @return Mview\View|Mview\View\Changelog|\PHPUnit_Framework_MockObject_MockObject
171
157
*/
172
- protected function generateMviewStub (array $ viewData , array $ changelogData, array $ stateData )
158
+ protected function generateMviewStub (array $ viewData , array $ changelogData )
173
159
{
174
160
/** @var Mview\View\Changelog|\PHPUnit_Framework_MockObject_MockObject $stub */
175
161
$ changelog = $ this ->getMockBuilder (\Magento \Framework \Mview \View \Changelog::class)
176
162
->disableOriginalConstructor ()
177
163
->getMock ();
178
164
179
165
$ list = [];
180
- if ($ changelogData ['version_id ' ] !== $ stateData ['version_id ' ]) {
181
- $ list = range ($ stateData ['version_id ' ]+1 , $ changelogData ['version_id ' ]);
166
+ if ($ changelogData ['version_id ' ] !== $ viewData ['version_id ' ]) {
167
+ $ list = range ($ viewData ['version_id ' ]+1 , $ changelogData ['version_id ' ]);
182
168
}
183
169
184
170
$ changelog ->expects ($ this ->any ())
@@ -189,14 +175,6 @@ protected function generateMviewStub(array $viewData, array $changelogData, arra
189
175
->method ('getVersion ' )
190
176
->willReturn ($ changelogData ['version_id ' ]);
191
177
192
- /** @var \Magento\Indexer\Model\Mview\View\State|\PHPUnit_Framework_MockObject_MockObject $stub */
193
- $ state = $ this ->getMockBuilder (\Magento \Indexer \Model \Mview \View \State::class)
194
- ->disableOriginalConstructor ()
195
- ->setMethods (['loadByView ' ])
196
- ->getMock ();
197
-
198
- $ state ->setData ($ stateData );
199
-
200
178
/** @var Mview\View|\PHPUnit_Framework_MockObject_MockObject $stub */
201
179
$ stub = $ this ->getMockBuilder (\Magento \Framework \Mview \View::class)
202
180
->disableOriginalConstructor ()
@@ -209,7 +187,7 @@ protected function generateMviewStub(array $viewData, array $changelogData, arra
209
187
210
188
$ stub ->expects ($ this ->any ())
211
189
->method ('getState ' )
212
- ->willReturn ( $ state );
190
+ ->willReturnSelf ( );
213
191
214
192
$ stub ->setData ($ viewData );
215
193
0 commit comments