Skip to content

Commit 6db8374

Browse files
committed
MC-16192: Fixes for unit test after merging mainline
1 parent 986d9d8 commit 6db8374

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ class StorageTest extends \PHPUnit\Framework\TestCase
110110
/**
111111
* @var \Magento\Framework\Filesystem\Io\File|\PHPUnit_Framework_MockObject_MockObject
112112
*/
113-
protected $ioFile;
113+
protected $ioFileMock;
114+
115+
/**
116+
* @var \Magento\Framework\Filesystem\Driver\File|\PHPUnit\Framework\MockObject\MockObject
117+
*/
118+
private $fileMock;
114119

115120
private $allowedImageExtensions = [
116121
'jpg' => 'image/jpg',
@@ -153,8 +158,9 @@ protected function setUp()
153158
$this->returnValue($this->directoryMock)
154159
);
155160

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(
158164
$this->any()
159165
)->method(
160166
'getPathInfo'
@@ -247,7 +253,8 @@ function ($path) {
247253
'include' => [],
248254
],
249255
'data' => [],
250-
'ioFile' => $this->ioFile
256+
'file' => $this->fileMock,
257+
'ioFile' => $this->ioFileMock
251258
]
252259
);
253260
}
@@ -514,6 +521,8 @@ public function testUploadFile()
514521
]
515522
);
516523

524+
$this->fileMock->expects($this->any())->method('getParentDirectory')->willReturn($path);
525+
517526
$image = $this->getMockBuilder(\Magento\Catalog\Model\Product\Image::class)
518527
->disableOriginalConstructor()
519528
->setMethods(['open', 'keepAspectRatio', 'resize', 'save'])

0 commit comments

Comments
 (0)