@@ -148,11 +148,6 @@ class InstallerTest extends \PHPUnit\Framework\TestCase
148
148
ConfigOptionsListConstants::KEY_PASSWORD => '' ,
149
149
];
150
150
151
- /**
152
- * @var \Magento\Framework\Model\ResourceModel\Db\Context|\PHPUnit_Framework_MockObject_MockObject
153
- */
154
- private $ contextMock ;
155
-
156
151
protected function setUp ()
157
152
{
158
153
$ this ->filePermissions = $ this ->createMock (\Magento \Framework \Setup \FilePermissions::class);
@@ -177,8 +172,6 @@ protected function setUp()
177
172
$ this ->maintenanceMode = $ this ->createMock (\Magento \Framework \App \MaintenanceMode::class);
178
173
$ this ->filesystem = $ this ->createMock (\Magento \Framework \Filesystem::class);
179
174
$ this ->objectManager = $ this ->getMockForAbstractClass (\Magento \Framework \ObjectManagerInterface::class);
180
- $ this ->contextMock =
181
- $ this ->createMock (\Magento \Framework \Model \ResourceModel \Db \Context::class);
182
175
$ this ->configModel = $ this ->createMock (\Magento \Setup \Model \ConfigModel::class);
183
176
$ this ->cleanupFiles = $ this ->createMock (\Magento \Framework \App \State \CleanupFiles::class);
184
177
$ this ->dbValidator = $ this ->createMock (\Magento \Setup \Validator \DbValidator::class);
@@ -223,7 +216,6 @@ private function createObject($connectionFactory = false, $objectManagerProvider
223
216
$ this ->maintenanceMode ,
224
217
$ this ->filesystem ,
225
218
$ objectManagerProvider ,
226
- $ this ->contextMock ,
227
219
$ this ->configModel ,
228
220
$ this ->cleanupFiles ,
229
221
$ this ->dbValidator ,
@@ -262,9 +254,6 @@ public function testInstall()
262
254
$ table ->expects ($ this ->any ())->method ('setComment ' )->willReturn ($ table );
263
255
$ table ->expects ($ this ->any ())->method ('addIndex ' )->willReturn ($ table );
264
256
$ connection ->expects ($ this ->any ())->method ('newTable ' )->willReturn ($ table );
265
- $ resource = $ this ->createMock (\Magento \Framework \App \ResourceConnection::class);
266
- $ this ->contextMock ->expects ($ this ->any ())->method ('getResources ' )->willReturn ($ resource );
267
- $ resource ->expects ($ this ->any ())->method ('getConnection ' )->will ($ this ->returnValue ($ connection ));
268
257
$ dataSetup = $ this ->createMock (\Magento \Setup \Module \DataSetup::class);
269
258
$ cacheManager = $ this ->createMock (\Magento \Framework \App \Cache \Manager::class);
270
259
$ cacheManager ->expects ($ this ->any ())->method ('getAvailableTypes ' )->willReturn (['foo ' , 'bar ' ]);
@@ -277,19 +266,22 @@ public function testInstall()
277
266
$ appState ->expects ($ this ->once ())
278
267
->method ('setAreaCode ' )
279
268
->with (\Magento \Framework \App \Area::AREA_GLOBAL );
280
- $ this ->setupFactory ->expects ($ this ->atLeastOnce ())->method ('create ' )->with ($ resource )->willReturn ($ setup );
269
+ $ moduleResource = $ this ->createMock (\Magento \Framework \Module \ModuleResource::class);
270
+ $ this ->setupFactory ->expects ($ this ->atLeastOnce ())->method ('create ' )->willReturn ($ setup );
281
271
$ this ->dataSetupFactory ->expects ($ this ->atLeastOnce ())->method ('create ' )->willReturn ($ dataSetup );
282
272
$ this ->objectManager ->expects ($ this ->any ())
283
273
->method ('create ' )
284
274
->will ($ this ->returnValueMap ([
285
275
[\Magento \Framework \App \Cache \Manager::class, [], $ cacheManager ],
286
276
[\Magento \Framework \App \State::class, [], $ appState ],
277
+ [\Magento \Framework \Module \ModuleResource::class, [], $ moduleResource ]
287
278
]));
288
279
$ this ->objectManager ->expects ($ this ->any ())
289
280
->method ('get ' )
290
281
->will ($ this ->returnValueMap ([
291
282
[\Magento \Framework \App \State::class, $ appState ],
292
- [\Magento \Framework \App \Cache \Manager::class, $ cacheManager ]
283
+ [\Magento \Framework \App \Cache \Manager::class, $ cacheManager ],
284
+ [\Magento \Framework \Module \ModuleResource::class, [], $ moduleResource ]
293
285
]));
294
286
$ this ->adminFactory ->expects ($ this ->once ())->method ('create ' )->willReturn (
295
287
$ this ->createMock (\Magento \Setup \Model \AdminAccount::class)
0 commit comments