@@ -26,8 +26,6 @@ class ConnectManagerTest extends \PHPUnit_Framework_TestCase
26
26
27
27
private $ composerInformationMock ;
28
28
29
- private $ applicationFactoryMock ;
30
-
31
29
public function setUp ()
32
30
{
33
31
$ this ->serviceLocatorMock = $ this ->_getServiceLocatorMock ();
@@ -36,7 +34,6 @@ public function setUp()
36
34
);
37
35
$ this ->curlClientMock = $ this ->_getCurlClientMock (['setCredentials ' , 'getBody ' , 'post ' ]);
38
36
$ this ->filesystemMock = $ this ->_getFilesystemMock (['getDirectoryRead ' , 'getDirectoryWrite ' ]);
39
- $ this ->applicationFactoryMock = $ this ->_getApplicationFactoryMock (['create ' ]);
40
37
}
41
38
42
39
/**
@@ -50,8 +47,7 @@ public function testGetCheckCredentialUrl()
50
47
$ this ->serviceLocatorMock ,
51
48
$ this ->composerInformationMock ,
52
49
$ this ->curlClientMock ,
53
- $ this ->filesystemMock ,
54
- $ this ->applicationFactoryMock
50
+ $ this ->filesystemMock
55
51
]
56
52
);
57
53
$ connectManager
@@ -76,8 +72,7 @@ public function testGetCredentialBaseUrl()
76
72
$ this ->serviceLocatorMock ,
77
73
$ this ->composerInformationMock ,
78
74
$ this ->curlClientMock ,
79
- $ this ->filesystemMock ,
80
- $ this ->applicationFactoryMock
75
+ $ this ->filesystemMock
81
76
]
82
77
);
83
78
$ this ->serviceLocatorMock
@@ -107,8 +102,7 @@ public function testGetPackagesJsonUrl()
107
102
$ this ->serviceLocatorMock ,
108
103
$ this ->composerInformationMock ,
109
104
$ this ->curlClientMock ,
110
- $ this ->filesystemMock ,
111
- $ this ->applicationFactoryMock
105
+ $ this ->filesystemMock
112
106
]
113
107
);
114
108
$ connectManager
@@ -136,8 +130,7 @@ public function testCheckCredentialsAction()
136
130
$ this ->serviceLocatorMock ,
137
131
$ this ->composerInformationMock ,
138
132
$ this ->curlClientMock ,
139
- $ this ->filesystemMock ,
140
- $ this ->applicationFactoryMock
133
+ $ this ->filesystemMock
141
134
]
142
135
);
143
136
$ this ->curlClientMock
@@ -172,8 +165,7 @@ public function testCheckCredentialsActionWithException()
172
165
$ this ->serviceLocatorMock ,
173
166
$ this ->composerInformationMock ,
174
167
$ this ->curlClientMock ,
175
- $ this ->filesystemMock ,
176
- $ this ->applicationFactoryMock
168
+ $ this ->filesystemMock
177
169
]
178
170
);
179
171
$ this ->curlClientMock
@@ -214,8 +206,7 @@ public function testGetPackagesJson()
214
206
$ this ->serviceLocatorMock ,
215
207
$ this ->composerInformationMock ,
216
208
$ this ->curlClientMock ,
217
- $ this ->filesystemMock ,
218
- $ this ->applicationFactoryMock
209
+ $ this ->filesystemMock
219
210
]
220
211
);
221
212
$ this ->curlClientMock
@@ -255,8 +246,7 @@ public function testGetPackagesJsonWithException()
255
246
$ this ->serviceLocatorMock ,
256
247
$ this ->composerInformationMock ,
257
248
$ this ->curlClientMock ,
258
- $ this ->filesystemMock ,
259
- $ this ->applicationFactoryMock
249
+ $ this ->filesystemMock
260
250
]
261
251
);
262
252
$ this ->curlClientMock
@@ -301,8 +291,7 @@ public function testSyncPackagesForInstall()
301
291
$ this ->serviceLocatorMock ,
302
292
$ this ->composerInformationMock ,
303
293
$ this ->curlClientMock ,
304
- $ this ->filesystemMock ,
305
- $ this ->applicationFactoryMock
294
+ $ this ->filesystemMock
306
295
]
307
296
);
308
297
$ connectManager
@@ -378,8 +367,7 @@ public function testGetAuthJsonData()
378
367
$ this ->serviceLocatorMock ,
379
368
$ this ->composerInformationMock ,
380
369
$ this ->curlClientMock ,
381
- $ this ->filesystemMock ,
382
- $ this ->applicationFactoryMock
370
+ $ this ->filesystemMock
383
371
]
384
372
);
385
373
$ connectManager
@@ -414,8 +402,7 @@ public function testGetAuthJson()
414
402
$ this ->serviceLocatorMock ,
415
403
$ this ->composerInformationMock ,
416
404
$ this ->curlClientMock ,
417
- $ this ->filesystemMock ,
418
- $ this ->applicationFactoryMock
405
+ $ this ->filesystemMock
419
406
]
420
407
);
421
408
$ directory = $ this ->_getDirectoryMock ();
@@ -460,8 +447,7 @@ public function testRemoveCredentials()
460
447
$ this ->serviceLocatorMock ,
461
448
$ this ->composerInformationMock ,
462
449
$ this ->curlClientMock ,
463
- $ this ->filesystemMock ,
464
- $ this ->applicationFactoryMock
450
+ $ this ->filesystemMock
465
451
]
466
452
);
467
453
$ directory = $ this ->_getDirectoryMock ();
@@ -526,8 +512,7 @@ public function testRemoveCredentialsEmptyHttpbasic()
526
512
$ this ->serviceLocatorMock ,
527
513
$ this ->composerInformationMock ,
528
514
$ this ->curlClientMock ,
529
- $ this ->filesystemMock ,
530
- $ this ->applicationFactoryMock
515
+ $ this ->filesystemMock
531
516
]
532
517
);
533
518
$ directory = $ this ->_getDirectoryMock ();
@@ -573,25 +558,27 @@ public function testSaveAuthJson()
573
558
{
574
559
$ connectManager = $ this ->_getConnectManagerMock (
575
560
[
561
+ 'getDirectory ' ,
576
562
'getCredentialBaseUrl ' ,
577
563
'getApplication '
578
564
],
579
565
[
580
566
$ this ->serviceLocatorMock ,
581
567
$ this ->composerInformationMock ,
582
568
$ this ->curlClientMock ,
583
- $ this ->filesystemMock ,
584
- $ this ->applicationFactoryMock
569
+ $ this ->filesystemMock
585
570
]
586
571
);
587
- $ application = $ this ->_getApplicationMock (['runComposerCommand ' ]);
572
+
573
+ $ directory = $ this ->_getDirectoryMock ();
588
574
$ connectManager
589
- ->expects ($ this ->once ())
590
- ->method ('getApplication ' )
591
- ->will ($ this ->returnValue ($ application ));
592
- $ this ->applicationFactoryMock
593
- ->expects ($ this ->never ())
594
- ->method ('runComposerCommand ' );
575
+ ->expects ($ this ->any ())
576
+ ->method ('getDirectory ' )
577
+ ->will ($ this ->returnValue ($ directory ));
578
+ $ directory
579
+ ->expects ($ this ->any ())
580
+ ->method ('writeFile ' )
581
+ ->will ($ this ->returnValue ($ directory ));
595
582
596
583
$ connectManager ->saveAuthJson ('username ' , 'password ' );
597
584
}
@@ -607,8 +594,7 @@ public function testSavePackagesForInstallToCache()
607
594
$ this ->serviceLocatorMock ,
608
595
$ this ->composerInformationMock ,
609
596
$ this ->curlClientMock ,
610
- $ this ->filesystemMock ,
611
- $ this ->applicationFactoryMock
597
+ $ this ->filesystemMock
612
598
]
613
599
);
614
600
$ directory = $ this ->_getDirectoryMock ();
@@ -639,8 +625,7 @@ public function testGetPackagesForInstallEmptyData()
639
625
$ this ->serviceLocatorMock ,
640
626
$ this ->composerInformationMock ,
641
627
$ this ->curlClientMock ,
642
- $ this ->filesystemMock ,
643
- $ this ->applicationFactoryMock
628
+ $ this ->filesystemMock
644
629
]
645
630
);
646
631
$ connectManager
@@ -667,8 +652,7 @@ public function testGetPackagesForInstall()
667
652
$ this ->serviceLocatorMock ,
668
653
$ this ->composerInformationMock ,
669
654
$ this ->curlClientMock ,
670
- $ this ->filesystemMock ,
671
- $ this ->applicationFactoryMock
655
+ $ this ->filesystemMock
672
656
]
673
657
);
674
658
$ connectManager
@@ -703,8 +687,7 @@ public function testLoadPackagesForInstallFromCache()
703
687
$ this ->serviceLocatorMock ,
704
688
$ this ->composerInformationMock ,
705
689
$ this ->curlClientMock ,
706
- $ this ->filesystemMock ,
707
- $ this ->applicationFactoryMock
690
+ $ this ->filesystemMock
708
691
]
709
692
);
710
693
@@ -782,28 +765,6 @@ protected function _getDirectoryMock()
782
765
return $ this ->getMockForAbstractClass ('\Magento\Framework\Filesystem\Directory\WriteInterface ' );
783
766
}
784
767
785
- /**
786
- * Gets ApplicationFactory mock
787
- *
788
- * @param null $methods
789
- * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Composer\MagentoComposerApplicationFactory
790
- */
791
- protected function _getApplicationFactoryMock ($ methods = null )
792
- {
793
- return $ this ->getMock ('Magento\Framework\Composer\MagentoComposerApplicationFactory ' , $ methods , [], '' , false );
794
- }
795
-
796
- /**
797
- * Gets Application mock
798
- *
799
- * @param null $methods
800
- * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Composer\MagentoComposerApplication
801
- */
802
- protected function _getApplicationMock ($ methods = null )
803
- {
804
- return $ this ->getMock ('Magento\Composer\MagentoComposerApplication ' , $ methods , [], '' , false );
805
- }
806
-
807
768
/**
808
769
* Gets ConnectManager mock
809
770
*
0 commit comments