@@ -110,7 +110,12 @@ class StorageTest extends \PHPUnit\Framework\TestCase
110
110
/**
111
111
* @var \Magento\Framework\Filesystem\Io\File|\PHPUnit_Framework_MockObject_MockObject
112
112
*/
113
- protected $ ioFile ;
113
+ protected $ ioFileMock ;
114
+
115
+ /**
116
+ * @var \Magento\Framework\Filesystem\Driver\File|\PHPUnit\Framework\MockObject\MockObject
117
+ */
118
+ private $ fileMock ;
114
119
115
120
private $ allowedImageExtensions = [
116
121
'jpg ' => 'image/jpg ' ,
@@ -153,8 +158,9 @@ protected function setUp()
153
158
$ this ->returnValue ($ this ->directoryMock )
154
159
);
155
160
156
- $ this ->ioFile = $ this ->createPartialMock (\Magento \Framework \Filesystem \Io \File::class, ['getPathInfo ' ]);
157
- $ this ->ioFile ->expects (
161
+ $ this ->fileMock = $ this ->createPartialMock (\Magento \Framework \Filesystem \Driver \File::class, ['getParentDirectory ' ]);
162
+ $ this ->ioFileMock = $ this ->createPartialMock (\Magento \Framework \Filesystem \Io \File::class, ['getPathInfo ' ]);
163
+ $ this ->ioFileMock ->expects (
158
164
$ this ->any ()
159
165
)->method (
160
166
'getPathInfo '
@@ -247,7 +253,8 @@ function ($path) {
247
253
'include ' => [],
248
254
],
249
255
'data ' => [],
250
- 'ioFile ' => $ this ->ioFile
256
+ 'file ' => $ this ->fileMock ,
257
+ 'ioFile ' => $ this ->ioFileMock
251
258
]
252
259
);
253
260
}
@@ -514,6 +521,8 @@ public function testUploadFile()
514
521
]
515
522
);
516
523
524
+ $ this ->fileMock ->expects ($ this ->any ())->method ('getParentDirectory ' )->willReturn ($ path );
525
+
517
526
$ image = $ this ->getMockBuilder (\Magento \Catalog \Model \Product \Image::class)
518
527
->disableOriginalConstructor ()
519
528
->setMethods (['open ' , 'keepAspectRatio ' , 'resize ' , 'save ' ])
0 commit comments