|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
6 | 6 |
|
| 7 | +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryExtensionFactory; |
| 8 | +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory; |
| 9 | +use Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface; |
| 10 | +use Magento\Framework\Api\Data\ImageContentInterfaceFactory; |
| 11 | +use Magento\Framework\Api\Data\VideoContentInterfaceFactory; |
| 12 | +use Magento\TestFramework\Helper\Bootstrap; |
| 13 | +use Magento\TestFramework\ObjectManager; |
| 14 | + |
7 | 15 | include __DIR__ . '/product_simple_with_full_option_set.php';
|
8 | 16 |
|
9 |
| -/** |
10 |
| - * @var \Magento\TestFramework\ObjectManager $objectManager |
11 |
| - */ |
12 |
| -$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); |
| 17 | +/** @var ObjectManager $objectManager */ |
| 18 | +$objectManager = Bootstrap::getObjectManager(); |
13 | 19 |
|
14 |
| -/** |
15 |
| - * @var \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory $mediaGalleryEntryFactory |
16 |
| - */ |
17 |
| - |
18 |
| -$mediaGalleryEntryFactory = $objectManager->get( |
19 |
| - \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory::class |
20 |
| -); |
| 20 | +/** @var ProductAttributeMediaGalleryEntryInterfaceFactory $mediaGalleryEntryFactory */ |
| 21 | +$mediaGalleryEntryFactory = $objectManager->get(ProductAttributeMediaGalleryEntryInterfaceFactory::class); |
21 | 22 |
|
22 |
| -/** |
23 |
| - * @var \Magento\Framework\Api\Data\ImageContentInterfaceFactory $imageContentFactory |
24 |
| - */ |
25 |
| -$imageContentFactory = $objectManager->get(\Magento\Framework\Api\Data\ImageContentInterfaceFactory::class); |
| 23 | +/** @var ImageContentInterfaceFactory $imageContentFactory */ |
| 24 | +$imageContentFactory = $objectManager->get(ImageContentInterfaceFactory::class); |
26 | 25 | $imageContent = $imageContentFactory->create();
|
27 |
| -$testImagePath = __DIR__ .'/magento_image.jpg'; |
| 26 | +$testImagePath = __DIR__ . '/magento_image.jpg'; |
28 | 27 | $imageContent->setBase64EncodedData(base64_encode(file_get_contents($testImagePath)));
|
29 | 28 | $imageContent->setType("image/jpeg");
|
30 | 29 | $imageContent->setName("1.jpg");
|
31 | 30 |
|
32 | 31 | $video = $mediaGalleryEntryFactory->create();
|
33 | 32 | $video->setDisabled(false);
|
34 |
| -//$video->setFile('1.png'); |
35 | 33 | $video->setFile('1.jpg');
|
36 | 34 | $video->setLabel('Video Label');
|
37 | 35 | $video->setMediaType('external-video');
|
38 | 36 | $video->setPosition(2);
|
39 | 37 | $video->setContent($imageContent);
|
40 | 38 |
|
41 |
| -/** |
42 |
| - * @var \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryExtensionFactory $mediaGalleryEntryExtensionFactory |
43 |
| - */ |
44 |
| -$mediaGalleryEntryExtensionFactory = $objectManager->get( |
45 |
| - \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryExtensionFactory::class |
46 |
| -); |
| 39 | +/** @var ProductAttributeMediaGalleryEntryExtensionFactory $mediaGalleryEntryExtensionFactory */ |
| 40 | +$mediaGalleryEntryExtensionFactory = $objectManager->get(ProductAttributeMediaGalleryEntryExtensionFactory::class); |
47 | 41 | $mediaGalleryEntryExtension = $mediaGalleryEntryExtensionFactory->create();
|
48 | 42 |
|
49 |
| -/** |
50 |
| - * @var \Magento\Framework\Api\Data\VideoContentInterfaceFactory $videoContentFactory |
51 |
| - */ |
52 |
| -$videoContentFactory = $objectManager->get( |
53 |
| - \Magento\Framework\Api\Data\VideoContentInterfaceFactory::class |
54 |
| -); |
| 43 | +/** @var VideoContentInterfaceFactory $videoContentFactory */ |
| 44 | +$videoContentFactory = $objectManager->get(VideoContentInterfaceFactory::class); |
55 | 45 | $videoContent = $videoContentFactory->create();
|
56 | 46 | $videoContent->setMediaType('external-video');
|
57 | 47 | $videoContent->setVideoDescription('Video description');
|
|
63 | 53 | $mediaGalleryEntryExtension->setVideoContent($videoContent);
|
64 | 54 | $video->setExtensionAttributes($mediaGalleryEntryExtension);
|
65 | 55 |
|
66 |
| -/** |
67 |
| - * @var \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface $mediaGalleryManagement |
68 |
| - */ |
69 |
| -$mediaGalleryManagement = $objectManager->get( |
70 |
| - \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface::class |
71 |
| -); |
| 56 | +/** @var ProductAttributeMediaGalleryManagementInterface $mediaGalleryManagement */ |
| 57 | +$mediaGalleryManagement = $objectManager->get(ProductAttributeMediaGalleryManagementInterface::class); |
72 | 58 | $mediaGalleryManagement->create('simple', $video);
|
0 commit comments