@@ -131,6 +131,11 @@ class InstallerTest extends \PHPUnit_Framework_TestCase
131
131
*/
132
132
private $ componentRegistrar ;
133
133
134
+ /**
135
+ * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\PhpReadinessCheck
136
+ */
137
+ private $ phpReadinessCheck ;
138
+
134
139
/**
135
140
* Sample DB configuration segment
136
141
*
@@ -179,6 +184,7 @@ protected function setUp()
179
184
$ this ->dataSetupFactory = $ this ->getMock ('Magento\Setup\Module\DataSetupFactory ' , [], [], '' , false );
180
185
$ this ->sampleDataState = $ this ->getMock ('Magento\Framework\Setup\SampleData\State ' , [], [], '' , false );
181
186
$ this ->componentRegistrar = $ this ->getMock ('Magento\Framework\Component\ComponentRegistrar ' , [], [], '' , false );
187
+ $ this ->phpReadinessCheck = $ this ->getMock ('Magento\Setup\Model\PhpReadinessCheck ' , [], [], '' , false );
182
188
$ this ->object = $ this ->createObject ();
183
189
}
184
190
@@ -220,7 +226,8 @@ private function createObject($connectionFactory = false, $objectManagerProvider
220
226
$ this ->setupFactory ,
221
227
$ this ->dataSetupFactory ,
222
228
$ this ->sampleDataState ,
223
- $ this ->componentRegistrar
229
+ $ this ->componentRegistrar ,
230
+ $ this ->phpReadinessCheck
224
231
);
225
232
}
226
233
@@ -280,33 +287,36 @@ public function testInstall()
280
287
$ this ->getMock ('Magento\Setup\Model\AdminAccount ' , [], [], '' , false )
281
288
);
282
289
$ this ->sampleDataState ->expects ($ this ->once ())->method ('hasError ' )->willReturn (true );
290
+ $ this ->phpReadinessCheck ->expects ($ this ->once ())->method ('checkPhpExtensions ' )->willReturn (
291
+ ['responseType ' => \Magento \Setup \Controller \ResponseTypeInterface::RESPONSE_TYPE_SUCCESS ]
292
+ );
283
293
284
294
$ this ->logger ->expects ($ this ->at (0 ))->method ('log ' )->with ('Starting Magento installation: ' );
285
295
$ this ->logger ->expects ($ this ->at (1 ))->method ('log ' )->with ('File permissions check... ' );
296
+ $ this ->logger ->expects ($ this ->at (3 ))->method ('log ' )->with ('Required extensions check... ' );
286
297
// at(2) invokes logMeta()
287
- $ this ->logger ->expects ($ this ->at (3 ))->method ('log ' )->with ('Enabling Maintenance Mode... ' );
298
+ $ this ->logger ->expects ($ this ->at (5 ))->method ('log ' )->with ('Enabling Maintenance Mode... ' );
288
299
// at(4) - logMeta and so on...
289
- $ this ->logger ->expects ($ this ->at (5 ))->method ('log ' )->with ('Installing deployment configuration... ' );
290
- $ this ->logger ->expects ($ this ->at (7 ))->method ('log ' )->with ('Installing database schema: ' );
291
- $ this ->logger ->expects ($ this ->at (9 ))->method ('log ' )->with ("Module 'Foo_One': " );
292
- $ this ->logger ->expects ($ this ->at (11 ))->method ('log ' )->with ("Module 'Bar_Two': " );
293
- $ this ->logger ->expects ($ this ->at (13 ))->method ('log ' )->with ('Schema post-updates: ' );
294
- $ this ->logger ->expects ($ this ->at (14 ))->method ('log ' )->with ("Module 'Foo_One': " );
295
- $ this ->logger ->expects ($ this ->at (16 ))->method ('log ' )->with ("Module 'Bar_Two': " );
296
- $ this ->logger ->expects ($ this ->at (19 ))->method ('log ' )->with ('Installing user configuration... ' );
297
- $ this ->logger ->expects ($ this ->at (21 ))->method ('log ' )->with ('Enabling caches: ' );
298
- $ this ->logger ->expects ($ this ->at (25 ))->method ('log ' )->with ('Installing data... ' );
299
- $ this ->logger ->expects ($ this ->at (26 ))->method ('log ' )->with ('Data install/update: ' );
300
- $ this ->logger ->expects ($ this ->at (27 ))->method ('log ' )->with ("Module 'Foo_One': " );
301
- $ this ->logger ->expects ($ this ->at (29 ))->method ('log ' )->with ("Module 'Bar_Two': " );
302
- $ this ->logger ->expects ($ this ->at (31 ))->method ('log ' )->with ('Data post-updates: ' );
303
- $ this ->logger ->expects ($ this ->at (32 ))->method ('log ' )->with ("Module 'Foo_One': " );
304
- $ this ->logger ->expects ($ this ->at (34 ))->method ('log ' )->with ("Module 'Bar_Two': " );
305
- $ this ->logger ->expects ($ this ->at (37 ))->method ('log ' )->with ('Installing admin user... ' );
306
- $ this ->logger ->expects ($ this ->at (39 ))->method ('log ' )->with ('Caches clearing: ' );
307
- $ this ->logger ->expects ($ this ->at (42 ))->method ('log ' )->with ('Disabling Maintenance Mode: ' );
308
- $ this ->logger ->expects ($ this ->at (44 ))->method ('log ' )->with ('Post installation file permissions check... ' );
309
- $ this ->logger ->expects ($ this ->at (46 ))->method ('log ' )->with ('Write installation date... ' );
300
+ $ this ->logger ->expects ($ this ->at (7 ))->method ('log ' )->with ('Installing deployment configuration... ' );
301
+ $ this ->logger ->expects ($ this ->at (9 ))->method ('log ' )->with ('Installing database schema: ' );
302
+ $ this ->logger ->expects ($ this ->at (11 ))->method ('log ' )->with ("Module 'Foo_One': " );
303
+ $ this ->logger ->expects ($ this ->at (13 ))->method ('log ' )->with ("Module 'Bar_Two': " );
304
+ $ this ->logger ->expects ($ this ->at (15 ))->method ('log ' )->with ('Schema post-updates: ' );
305
+ $ this ->logger ->expects ($ this ->at (16 ))->method ('log ' )->with ("Module 'Foo_One': " );
306
+ $ this ->logger ->expects ($ this ->at (18 ))->method ('log ' )->with ("Module 'Bar_Two': " );
307
+ $ this ->logger ->expects ($ this ->at (21 ))->method ('log ' )->with ('Installing user configuration... ' );
308
+ $ this ->logger ->expects ($ this ->at (23 ))->method ('log ' )->with ('Enabling caches: ' );
309
+ $ this ->logger ->expects ($ this ->at (27 ))->method ('log ' )->with ('Installing data... ' );
310
+ $ this ->logger ->expects ($ this ->at (28 ))->method ('log ' )->with ('Data install/update: ' );
311
+ $ this ->logger ->expects ($ this ->at (29 ))->method ('log ' )->with ("Module 'Foo_One': " );
312
+ $ this ->logger ->expects ($ this ->at (31 ))->method ('log ' )->with ("Module 'Bar_Two': " );
313
+ $ this ->logger ->expects ($ this ->at (33 ))->method ('log ' )->with ('Data post-updates: ' );
314
+ $ this ->logger ->expects ($ this ->at (34 ))->method ('log ' )->with ("Module 'Foo_One': " );
315
+ $ this ->logger ->expects ($ this ->at (36 ))->method ('log ' )->with ("Module 'Bar_Two': " );
316
+ $ this ->logger ->expects ($ this ->at (39 ))->method ('log ' )->with ('Installing admin user... ' );
317
+ $ this ->logger ->expects ($ this ->at (41 ))->method ('log ' )->with ('Caches clearing: ' );
318
+ $ this ->logger ->expects ($ this ->at (44 ))->method ('log ' )->with ('Disabling Maintenance Mode: ' );
319
+ $ this ->logger ->expects ($ this ->at (46 ))->method ('log ' )->with ('Post installation file permissions check... ' );
310
320
$ this ->logger ->expects ($ this ->at (48 ))->method ('logSuccess ' )->with ('Magento installation complete. ' );
311
321
$ this ->logger ->expects ($ this ->at (50 ))->method ('log ' )
312
322
->with ('Sample Data is installed with errors. See log file for details ' );
@@ -335,6 +345,27 @@ public function testCheckInstallationFilePermissionsError()
335
345
$ this ->object ->checkInstallationFilePermissions ();
336
346
}
337
347
348
+ public function testCheckExtensions ()
349
+ {
350
+ $ this ->phpReadinessCheck ->expects ($ this ->once ())->method ('checkPhpExtensions ' )->willReturn (
351
+ ['responseType ' => \Magento \Setup \Controller \ResponseTypeInterface::RESPONSE_TYPE_SUCCESS ]
352
+ );
353
+ $ this ->object ->checkExtensions ();
354
+ }
355
+
356
+ /**
357
+ * @expectedException \Exception
358
+ * @expectedExceptionMessage Missing following extensions: 'foo'
359
+ */
360
+ public function testCheckExtensionsError ()
361
+ {
362
+ $ this ->phpReadinessCheck ->expects ($ this ->once ())->method ('checkPhpExtensions ' )->willReturn (
363
+ ['responseType ' => \Magento \Setup \Controller \ResponseTypeInterface::RESPONSE_TYPE_ERROR ,
364
+ 'data ' =>['required ' =>['foo ' , 'bar ' ], 'missing ' =>['foo ' ]]]
365
+ );
366
+ $ this ->object ->checkExtensions ();
367
+ }
368
+
338
369
public function testCheckApplicationFilePermissions ()
339
370
{
340
371
$ this ->filePermissions
0 commit comments