File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
dev/tests/integration/testsuite/Magento/Sitemap/_files Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 15
15
$ filesystem = $ objectManager ->get (\Magento \Framework \Filesystem::class);
16
16
/** @var \Magento\Framework\Filesystem\Directory\WriteInterface $mediaDirectory */
17
17
$ mediaDirectory = $ filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
18
- $ mediaPath = $ mediaDirectory ->getAbsolutePath ();
19
18
$ baseTmpMediaPath = $ config ->getBaseTmpMediaPath ();
20
19
$ mediaDirectory ->create ($ baseTmpMediaPath );
21
20
22
- copy (__DIR__ . '/magento_image_sitemap.png ' , $ mediaPath . '/ ' . $ baseTmpMediaPath . '/magento_image_sitemap.png ' );
23
- copy (__DIR__ . '/second_image.png ' , $ mediaPath . '/ ' . $ baseTmpMediaPath . '/second_image.png ' );
21
+ $ imageSitemapPath = $ mediaDirectory ->getAbsolutePath ($ baseTmpMediaPath . '/magento_image_sitemap.png ' );
22
+ $ secondImagePath = $ mediaDirectory ->getAbsolutePath ($ baseTmpMediaPath . '/second_image.png ' );
23
+
24
+ $ imageSitemapContent = file_get_contents (__DIR__ . '/magento_image_sitemap.png ' );
25
+ $ secondImageContent = file_get_contents (__DIR__ . '/second_image.png ' );
26
+ $ mediaDirectory ->getDriver ()->filePutContents ($ imageSitemapPath , $ imageSitemapContent );
27
+ $ mediaDirectory ->getDriver ()->filePutContents ($ secondImagePath , $ secondImageContent );
24
28
25
29
$ product = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (\Magento \Catalog \Model \Product::class);
26
30
$ product ->setTypeId (
140
144
)->setThumbnail (
141
145
'/m/a/magento_image_sitemap.png '
142
146
)->addImageToMediaGallery (
143
- $ mediaPath . ' / ' . $ baseTmpMediaPath . ' /magento_image_sitemap.png ' ,
147
+ $ imageSitemapPath ,
144
148
null ,
145
149
false ,
146
150
false
147
151
)->addImageToMediaGallery (
148
- $ mediaPath . ' / ' . $ baseTmpMediaPath . ' /second_image.png ' ,
152
+ $ secondImagePath ,
149
153
null ,
150
154
false ,
151
155
false
You can’t perform that action at this time.
0 commit comments