File tree Expand file tree Collapse file tree 5 files changed +34
-12
lines changed
app/code/Magento/MediaGallery/Model
dev/tests/integration/testsuite/Magento/MediaGallery Expand file tree Collapse file tree 5 files changed +34
-12
lines changed Original file line number Diff line number Diff line change 13
13
14
14
/**
15
15
* Media Gallery Asset
16
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList
16
17
*/
17
18
class Asset implements AssetInterface
18
19
{
Original file line number Diff line number Diff line change 17
17
use Psr \Log \LoggerInterface ;
18
18
19
19
/**
20
- * Save asset keywords
20
+ * Save media asset keywords to database
21
21
* @deprecated use \Magento\MediaGalleryApi\Api\SaveAssetKeywordsInterface instead
22
22
*/
23
23
class SaveAssetKeywords implements SaveAssetKeywordsInterface
Original file line number Diff line number Diff line change @@ -106,7 +106,12 @@ public function testExecute(): void
106
106
$ asset = $ this ->assetFactory ->create (
107
107
[
108
108
'path ' => 'fruit.jpg ' ,
109
- 'contentType ' => 'image '
109
+ 'title ' => 'Img ' ,
110
+ 'source ' => 'Local ' ,
111
+ 'contentType ' => 'image/jpeg ' ,
112
+ 'width ' => 420 ,
113
+ 'height ' => 240 ,
114
+ 'size ' => 12877
110
115
]
111
116
);
112
117
$ this ->saveAssets ->execute ([$ asset ]);
Original file line number Diff line number Diff line change @@ -104,19 +104,34 @@ public function assetsDataProvider(): array
104
104
'assetsData ' => [
105
105
'asset1 ' => [
106
106
'path ' => 'fruit.jpg ' ,
107
- 'contentType ' => 'image '
107
+ 'title ' => 'Img ' ,
108
+ 'source ' => 'Local ' ,
109
+ 'contentType ' => 'image/jpeg ' ,
110
+ 'width ' => 420 ,
111
+ 'height ' => 240 ,
112
+ 'size ' => 12877
108
113
]
109
114
]
110
115
],
111
116
'Two assets ' => [
112
117
'assetsData ' => [
113
118
'asset1 ' => [
114
119
'path ' => 'image.jpg ' ,
115
- 'contentType ' => 'image '
120
+ 'title ' => 'Img ' ,
121
+ 'source ' => 'Local ' ,
122
+ 'contentType ' => 'image/jpeg ' ,
123
+ 'width ' => 420 ,
124
+ 'height ' => 240 ,
125
+ 'size ' => 12877
116
126
],
117
127
'asset2 ' => [
118
- 'path ' => 'image2.png ' ,
119
- 'contentType ' => 'image '
128
+ 'path ' => 'image2.jpg ' ,
129
+ 'title ' => 'Img ' ,
130
+ 'source ' => 'Local ' ,
131
+ 'contentType ' => 'image/jpeg ' ,
132
+ 'width ' => 420 ,
133
+ 'height ' => 240 ,
134
+ 'size ' => 12877
120
135
]
121
136
]
122
137
],
@@ -133,11 +148,7 @@ private function getAssets(array $assetsData): array
133
148
{
134
149
$ assets = [];
135
150
foreach ($ assetsData as $ assetData ) {
136
- $ assets [] = $ this ->assetFactory ->create (
137
- [
138
- 'data ' => $ assetData
139
- ]
140
- );
151
+ $ assets [] = $ this ->assetFactory ->create ($ assetData );
141
152
}
142
153
return $ assets ;
143
154
}
Original file line number Diff line number Diff line change 18
18
[
19
19
'id ' => 2020 ,
20
20
'path ' => 'testDirectory/path.jpg ' ,
21
- 'contentType ' => 'image '
21
+ 'contentType ' => 'image ' ,
22
+ 'title ' => 'Img ' ,
23
+ 'source ' => 'Local ' ,
24
+ 'width ' => 420 ,
25
+ 'height ' => 240 ,
26
+ 'size ' => 12877
22
27
]
23
28
);
24
29
/** @var SaveInterface $mediaSave */
You can’t perform that action at this time.
0 commit comments