Skip to content

Commit 87588fd

Browse files
Chhandak.BaruaChhandak.Barua
authored andcommitted
ACP2E-3504: Product images not resized when added as configurable product
1 parent 2a9226b commit 87588fd

File tree

1 file changed

+2
-69
lines changed
  • dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Gallery

1 file changed

+2
-69
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Gallery/UploadTest.php

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2011 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

@@ -15,7 +15,6 @@
1515
use Magento\Framework\Filesystem\DirectoryList;
1616
use Magento\Framework\Serialize\Serializer\Json;
1717
use Magento\TestFramework\TestCase\AbstractBackendController;
18-
use Magento\Framework\App\Config\ScopeConfigInterface;
1918

2019
/**
2120
* Provide tests for admin product upload image action.
@@ -54,11 +53,6 @@ class UploadTest extends AbstractBackendController
5453
*/
5554
private $config;
5655

57-
/**
58-
* @var ScopeConfigInterface
59-
*/
60-
private mixed $scopeConfig;
61-
6256
/**
6357
* @inheritdoc
6458
*/
@@ -99,67 +93,6 @@ public function testUploadAction(array $file, array $expectation): void
9993
));
10094
}
10195

102-
/**
103-
* Test upload image on admin product page.
104-
*
105-
* @dataProvider uploadActionDataProvider
106-
* @magentoDbIsolation enabled
107-
* @param array $file
108-
* @param array $expectation
109-
* @return void
110-
*/
111-
public function testUploadWithResizeAction(array $file, array $expectation): void
112-
{
113-
$this->copyFileToSysTmpDir($file);
114-
$this->scopeConfig->setValue(
115-
'system/upload_configuration/max_width',
116-
100
117-
);
118-
$this->scopeConfig->setValue(
119-
'system/upload_configuration/max_height',
120-
100
121-
);
122-
$this->getRequest()->setMethod($this->httpMethod);
123-
$this->dispatch($this->uri);
124-
$jsonBody = $this->serializer->unserialize($this->getResponse()->getBody());
125-
$this->assertEquals($jsonBody['name'], $expectation['name']);
126-
$this->assertEquals($jsonBody['type'], $expectation['type']);
127-
$this->assertEquals($jsonBody['file'], $expectation['file']);
128-
$this->assertEquals($jsonBody['url'], $expectation['url']);
129-
$this->assertArrayNotHasKey('error', $jsonBody);
130-
$this->assertArrayNotHasKey('errorcode', $jsonBody);
131-
$this->assertTrue($this->mediaDirectory->isExist(
132-
$this->getFileAbsolutePath($expectation['tmp_media_path'])
133-
));
134-
$dimensions = $this->getImageDimensions($this->getFileAbsolutePath($expectation['tmp_media_path']));
135-
$this->assertLessThanOrEqual(100, $dimensions['width']);
136-
$this->assertLessThanOrEqual(100, $dimensions['height']);
137-
}
138-
139-
/**
140-
* Fetch uploaded image dimension.
141-
*
142-
* @param $imagePath
143-
* @return array|false
144-
*/
145-
private function getImageDimensions($imagePath)
146-
{
147-
if (!file_exists($imagePath)) {
148-
return false;
149-
}
150-
151-
$imageInfo = getimagesize($imagePath);
152-
153-
if ($imageInfo === false) {
154-
return false;
155-
}
156-
157-
return [
158-
'width' => $imageInfo[0],
159-
'height' => $imageInfo[1],
160-
];
161-
}
162-
16396
/**
16497
* @return array
16598
*/

0 commit comments

Comments
 (0)