Skip to content

Commit 050dd88

Browse files
committed
Merge remote-tracking branch 'local/ACP2E-1701' into PR_6_MAR_2023
2 parents bb420ce + 4d12a9b commit 050dd88

File tree

2 files changed

+16
-5
lines changed
  • dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver
  • lib/internal/Magento/Framework/Filesystem/Driver

2 files changed

+16
-5
lines changed

dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver/FileTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
/**
3-
* Test for \Magento\Framework\Filesystem\Driver\File
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
@@ -174,6 +172,18 @@ public function testFilePutWithoutContents(): void
174172
$this->assertEquals(0, $this->driver->filePutContents($path, ''));
175173
}
176174

175+
/**
176+
* Delete a not existing file
177+
*
178+
* @return void
179+
* @throws FileSystemException
180+
*/
181+
public function testDeleteFileEdge(): void
182+
{
183+
$path = $this->absolutePath . 'foo/file_four.txt';
184+
$this->assertEquals(true, $this->driver->deleteFile($path));
185+
}
186+
177187
/**
178188
* Remove generated directories.
179189
*

lib/internal/Magento/Framework/Filesystem/Driver/File.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,19 +440,20 @@ public function symlink($source, $destination, DriverInterface $targetDriver = n
440440
*/
441441
public function deleteFile($path)
442442
{
443-
$result = @unlink($this->getScheme() . $path);
443+
@unlink($this->getScheme() . $path);
444444
if ($this->stateful) {
445445
clearstatcache(true, $this->getScheme() . $path);
446446
}
447-
if (!$result) {
447+
448+
if ($this->isFile($path)) {
448449
throw new FileSystemException(
449450
new Phrase(
450451
'The "%1" file can\'t be deleted. %2',
451452
[$path, $this->getWarningMessage()]
452453
)
453454
);
454455
}
455-
return $result;
456+
return true;
456457
}
457458

458459
/**

0 commit comments

Comments
 (0)