Fix: delete of files with [ and glob.

Conflicts:
	test/phpunit/FilesLibTest.php
This commit is contained in:
Laurent Destailleur
2013-04-30 22:52:56 +02:00
parent f8b133dad4
commit c84427bd22
2 changed files with 17 additions and 5 deletions

View File

@@ -326,7 +326,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
// Again to test with overwriting=1
$result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,1);
print __METHOD__." result=".$result."\n";
$this->assertGreaterThanOrEqual(1,$result); // Should be 1
$this->assertGreaterThanOrEqual(1,$result,'copy destination already exists, overwrite'); // Should be 1
// Again to test with overwriting=1
$result=dol_move($conf->admin->dir_temp.'/file.csv',$conf->admin->dir_temp.'/file2.csv',0,1);
@@ -340,7 +340,17 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
// Again to test no erreor when deleteing a non existing file
$result=dol_delete_file($conf->admin->dir_temp.'/file2.csv');
print __METHOD__." result=".$result."\n";
$this->assertTrue($result);
$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);
print __METHOD__." result=".$result."\n";
$this->assertGreaterThanOrEqual(1,$result,'copy file with special char, overwrite'); // Should be 1
// Try to delete using a glob criteria
$result=dol_delete_file($conf->admin->dir_temp.'/file with [x]*é.csv');
print __METHOD__." result=".$result."\n";
$this->assertTrue($result,'delete file using glob criteria');
}
/**
@@ -377,4 +387,4 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
$this->assertEquals(0,count($result));
}
}
?>
?>