Skip to content

Commit e4756d6

Browse files
committed
MAGETWO-88645: Error while deleting a Product Image
1 parent 26d2985 commit e4756d6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/UpdateHandlerTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* Test for \Magento\Catalog\Model\Product\Gallery\UpdateHandler.
2020
*
2121
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
22+
* @magentoDataFixture Magento/Catalog/_files/product_image.php
2223
*/
2324
class UpdateHandlerTest extends \PHPUnit\Framework\TestCase
2425
{
@@ -58,10 +59,7 @@ protected function setUp()
5859
$this->updateHandler = $this->objectManager->create(UpdateHandler::class);
5960
$this->filesystem = $this->objectManager->get(Filesystem::class);
6061
$this->rootDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
61-
62-
$filePath = $this->rootDirectory->getAbsolutePath($this->fileName);
63-
$file = fopen($filePath, "wb");
64-
fwrite($file, 'Test');
62+
$this->rootDirectory->writeFile($this->rootDirectory->getAbsolutePath($this->fileName), 'Test');
6563
}
6664

6765
/**
@@ -97,7 +95,6 @@ public function testExecuteWithIllegalFilename(): void
9795
*/
9896
protected function tearDown(): void
9997
{
100-
parent::tearDown();
101-
unlink($this->rootDirectory->getAbsolutePath($this->fileName));
98+
$this->rootDirectory->getDriver()->deleteFile($this->rootDirectory->getAbsolutePath($this->fileName));
10299
}
103100
}

0 commit comments

Comments
 (0)