Skip to content

Commit 573798c

Browse files
committed
MC-17765: Category A image replaced by uploading to Category B
1 parent 8cfdffd commit 573798c

File tree

1 file changed

+5
-6
lines changed
  • app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend

1 file changed

+5
-6
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/ImageTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ public function testBeforeSaveAttributeFileName()
158158
->method('getAbsolutePath')
159159
->with('base/path/test123.jpg')
160160
->willReturn('absolute/path/base/path/test123.jpg');
161-
$mediaDirectoryMock->expects($this->once())
162-
->method('isExist')
163-
->with('absolute/path/base/path/test123.jpg')
164-
->willReturn(false);
165161

166162
$object = new \Magento\Framework\DataObject(
167163
[
@@ -194,12 +190,15 @@ public function testBeforeSaveAttributeFileNameOutsideOfCategoryDir()
194190
->method('getUri')
195191
->with(DirectoryList::MEDIA)
196192
->willReturn('pub/media');
193+
$mediaDirectoryMock->expects($this->once())
194+
->method('getAbsolutePath')
195+
->willReturn('/pub/media/wysiwyg/test123.jpg');
197196

198197
$object = new \Magento\Framework\DataObject(
199198
[
200199
'test_attribute' => [
201200
[
202-
'name' => '/test123.jpg',
201+
'name' => 'test123.jpg',
203202
'url' => '/pub/media/wysiwyg/test123.jpg',
204203
],
205204
],
@@ -208,7 +207,7 @@ public function testBeforeSaveAttributeFileNameOutsideOfCategoryDir()
208207

209208
$model->beforeSave($object);
210209

211-
$this->assertEquals('/pub/media/wysiwyg/test123.jpg', $object->getTestAttribute());
210+
$this->assertEquals('test123.jpg', $object->getTestAttribute());
212211
$this->assertEquals(
213212
[['name' => '/pub/media/wysiwyg/test123.jpg', 'url' => '/pub/media/wysiwyg/test123.jpg']],
214213
$object->getData('_additional_data_test_attribute')

0 commit comments

Comments
 (0)