From d925ecb4f1359a094c889ce9a8d0d0911407e34e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 May 2015 17:09:35 +0200 Subject: [PATCH] Revert "Made test pessimistic by default" --- htdocs/core/lib/files.lib.php | 6 ++++-- test/phpunit/FilesLibTest.php | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 85429d96ac74c..daae392cd393a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -802,7 +802,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable */ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) { - global $langs; + global $db, $conf, $user, $langs; global $hookmanager; $langs->load("other"); @@ -829,8 +829,10 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n } else { + $error=0; + //print "x".$file." ".$disableglob;exit; - $ok=false; + $ok=true; $file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset if (empty($disableglob) && ! empty($file_osencoded)) { diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 409816d5f90d3..4477784ae7d69 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -339,9 +339,10 @@ public function testDolCopyMoveDelete() print __METHOD__." result=".$result."\n"; $this->assertTrue($result,'delete file'); + // Again to test no error when deleteing a non existing file $result=dol_delete_file($conf->admin->dir_temp.'/file2.csv'); print __METHOD__." result=".$result."\n"; - $this->assertFalse($result,'delete file that does not exists'); + $this->assertTrue($result,'delete file that does not exists'); // Test copy with special char / delete with blob $result=dol_copy($file, $conf->admin->dir_temp.'/file with [x] and é.csv',0,1);