@@ -26,6 +26,11 @@ class ComposerInformationTest extends \PHPUnit_Framework_TestCase
26
26
*/
27
27
private $ ioMock ;
28
28
29
+ /**
30
+ * @var BufferIoFactory|\PHPUnit_Framework_MockObject_MockObject
31
+ */
32
+ private $ bufferIoFactoryMock ;
33
+
29
34
public function setUp ()
30
35
{
31
36
$ this ->directoryReadMock = $ this ->getMock ('Magento\Framework\Filesystem\Directory\Read ' , [], [], '' , false );
@@ -35,6 +40,8 @@ public function setUp()
35
40
->method ('getDirectoryRead ' )
36
41
->will ($ this ->returnValue ($ this ->directoryReadMock ));
37
42
$ this ->ioMock = $ this ->getMock ('Composer\IO\BufferIO ' , [], [], '' , false );
43
+ $ this ->bufferIoFactoryMock = $ this ->getMock ('Magento\Framework\Composer\BufferIoFactory ' , [], [], '' , false );
44
+ $ this ->bufferIoFactoryMock ->expects ($ this ->any ())->method ('create ' )->willReturn ($ this ->ioMock );
38
45
}
39
46
40
47
/**
@@ -63,7 +70,7 @@ private function setupDirectoryMock($composerDir)
63
70
public function testGetRequiredPhpVersion ($ composerDir )
64
71
{
65
72
$ this ->setupDirectoryMock ($ composerDir );
66
- $ composerInfo = new ComposerInformation ($ this ->filesystemMock , $ this ->ioMock );
73
+ $ composerInfo = new ComposerInformation ($ this ->filesystemMock , $ this ->bufferIoFactoryMock );
67
74
$ this ->assertEquals ("~5.5.0|~5.6.0 " , $ composerInfo ->getRequiredPhpVersion ());
68
75
}
69
76
@@ -75,7 +82,7 @@ public function testGetRequiredPhpVersion($composerDir)
75
82
public function testGetRequiredExtensions ($ composerDir )
76
83
{
77
84
$ this ->setupDirectoryMock ($ composerDir );
78
- $ composerInfo = new ComposerInformation ($ this ->filesystemMock , $ this ->ioMock );
85
+ $ composerInfo = new ComposerInformation ($ this ->filesystemMock , $ this ->bufferIoFactoryMock );
79
86
$ expectedExtensions = ['ctype ' , 'gd ' , 'spl ' , 'dom ' , 'simplexml ' , 'mcrypt ' , 'hash ' , 'curl ' , 'iconv ' , 'intl ' ];
80
87
81
88
$ actualRequiredExtensions = $ composerInfo ->getRequiredExtensions ();
@@ -92,7 +99,7 @@ public function testGetRequiredExtensions($composerDir)
92
99
public function testGetRootRequiredPackagesAndTypes ($ composerDir )
93
100
{
94
101
$ this ->setupDirectoryMock ($ composerDir );
95
- $ composerInfo = new ComposerInformation ($ this ->filesystemMock , $ this ->ioMock );
102
+ $ composerInfo = new ComposerInformation ($ this ->filesystemMock , $ this ->bufferIoFactoryMock );
96
103
97
104
$ requiredPackagesAndTypes = $ composerInfo ->getRootRequiredPackageTypesByName ();
98
105
@@ -121,6 +128,6 @@ public function getRequiredPhpVersionDataProvider()
121
128
public function testNoLock ()
122
129
{
123
130
$ this ->setupDirectoryMock ('notARealDirectory ' );
124
- new ComposerInformation ($ this ->filesystemMock , $ this ->ioMock );
131
+ new ComposerInformation ($ this ->filesystemMock , $ this ->bufferIoFactoryMock );
125
132
}
126
133
}
0 commit comments