Skip to content

Commit e88833b

Browse files
committed
fixed static tests
1 parent d463494 commit e88833b

File tree

5 files changed

+33
-24
lines changed

5 files changed

+33
-24
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery;
1515

1616
use Magento\Backend\Block\DataProviders\ImageUploadConfig as ImageUploadConfigDataProvider;
17-
use Magento\Framework\Storage\FileNotFoundException;
18-
use Magento\Framework\App\ObjectManager;
1917
use Magento\Backend\Block\Media\Uploader;
20-
use Magento\Framework\Storage\StorageProvider;
21-
use Magento\Framework\View\Element\AbstractBlock;
2218
use Magento\Framework\App\Filesystem\DirectoryList;
19+
use Magento\Framework\App\ObjectManager;
2320
use Magento\Framework\Exception\FileSystemException;
21+
use Magento\Framework\Storage\FileNotFoundException;
22+
use Magento\Framework\Storage\StorageProvider;
23+
use Magento\Framework\View\Element\AbstractBlock;
2424
use Magento\MediaStorage\Helper\File\Storage\Database;
2525

2626
/**
@@ -173,6 +173,8 @@ public function getAddImagesButton()
173173
}
174174

175175
/**
176+
* Sync images to database
177+
*
176178
* @param string $fileName
177179
*/
178180
private function syncImageToDatabase(string $fileName): void
@@ -187,6 +189,8 @@ private function syncImageToDatabase(string $fileName): void
187189
}
188190

189191
/**
192+
* Returns file metadata as an associative array
193+
*
190194
* @param string $fileName
191195
* @return array
192196
* @throws FileNotFoundException

app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ class Gallery extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
3535
protected $metadata;
3636

3737
/**
38-
* Gallery constructor.
39-
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
40-
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
41-
* @param string $connectionName
42-
* @throws \Exception
43-
*/
38+
* Gallery constructor.
39+
*
40+
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
41+
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
42+
* @param null $connectionName
43+
* @throws \Exception
44+
*/
4445
public function __construct(
4546
\Magento\Framework\Model\ResourceModel\Db\Context $context,
4647
\Magento\Framework\EntityManager\MetadataPool $metadataPool,
@@ -49,7 +50,6 @@ public function __construct(
4950
$this->metadata = $metadataPool->getMetadata(
5051
\Magento\Catalog\Api\Data\ProductInterface::class
5152
);
52-
5353
parent::__construct($context, $connectionName);
5454
}
5555

@@ -160,6 +160,8 @@ protected function createBaseLoadSelect($entityId, $storeId, $attributeId)
160160
}
161161

162162
/**
163+
* Returns media entries from database
164+
*
163165
* @param int $storeId
164166
* @param array $entityIds
165167
* @param bool $preserveSortOrder

app/code/Magento/MediaStorage/Test/Unit/Service/ImageResizeTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@
66
namespace Magento\MediaStorage\Test\Unit\Service;
77

88
use Magento\Catalog\Model\Product\Image\ParamsBuilder;
9-
use Magento\Catalog\Model\View\Asset\ImageFactory as AssetImageFactory;
9+
use Magento\Catalog\Model\Product\Media\ConfigInterface as MediaConfig;
10+
use Magento\Catalog\Model\ResourceModel\Product\Image as ProductImage;
1011
use Magento\Catalog\Model\View\Asset\Image as AssetImage;
12+
use Magento\Catalog\Model\View\Asset\ImageFactory as AssetImageFactory;
13+
use Magento\Framework\App\Filesystem\DirectoryList;
14+
use Magento\Framework\App\State;
15+
use Magento\Framework\Config\View;
1116
use Magento\Framework\DataObject;
1217
use Magento\Framework\Filesystem;
13-
use Magento\Framework\Image\Factory as ImageFactory;
1418
use Magento\Framework\Image;
15-
use Magento\Catalog\Model\Product\Media\ConfigInterface as MediaConfig;
16-
use Magento\Framework\App\State;
19+
use Magento\Framework\Image\Factory as ImageFactory;
1720
use Magento\Framework\Storage\StorageInterface;
1821
use Magento\Framework\View\ConfigInterface as ViewConfig;
19-
use Magento\Framework\Config\View;
20-
use Magento\Catalog\Model\ResourceModel\Product\Image as ProductImage;
22+
use Magento\MediaStorage\Helper\File\Storage\Database;
2123
use Magento\MediaStorage\Service\ImageResize;
2224
use Magento\Store\Model\StoreManagerInterface;
2325
use Magento\Theme\Model\Config\Customization as ThemeCustomizationConfig;
2426
use Magento\Theme\Model\ResourceModel\Theme\Collection;
25-
use Magento\MediaStorage\Helper\File\Storage\Database;
26-
use Magento\Framework\App\Filesystem\DirectoryList;
2727

2828
/**
29-
* Class ImageResizeTest
29+
* Class ImageResizeTest test for \Magento\MediaStorage\Service\ImageResize
3030
*
3131
* @SuppressWarnings(PHPMD.TooManyFields)
3232
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -215,8 +215,7 @@ protected function setUp()
215215
$this->viewMock->expects($this->any())
216216
->method('getMediaEntities')
217217
->willReturn(
218-
['product_small_image' =>
219-
[
218+
['product_small_image' => [
220219
'type' => 'small_image',
221220
'width' => 75,
222221
'height' => 75

lib/internal/Magento/Framework/Storage/FileNotFoundException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
namespace Magento\Framework\Storage;
99

1010
/**
11-
* Class FileNotFoundException
11+
* Exception: FileNotFoundException
12+
* Exception to be thrown when the a requested file does not exists
1213
*/
1314
class FileNotFoundException extends \RuntimeException
1415
{

lib/internal/Magento/Framework/Storage/RootViolationException.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77

88
namespace Magento\Framework\Storage;
99

10-
10+
/**
11+
* Exception: RootViolationException
12+
* Exception to be thrown when the a directory root not specified
13+
*/
1114
class RootViolationException extends \RuntimeException
1215
{
1316

0 commit comments

Comments
 (0)