More complete PHPunit test

This commit is contained in:
Laurent Destailleur 2015-10-14 22:36:32 +02:00
parent 00c8b27baf
commit e22b0b9a57

View File

@ -330,22 +330,28 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n";
$this->assertGreaterThanOrEqual(1,$result,'copy destination already exists, overwrite'); // Should be 1
// Again to test with overwriting=1
// To test a move that should work
$result=dol_move($conf->admin->dir_temp.'/file.csv',$conf->admin->dir_temp.'/file2.csv',0,1);
print __METHOD__." result=".$result."\n";
$this->assertTrue($result,'copy destination does not exists');
$this->assertTrue($result,'move with default mask');
$result=dol_delete_file($conf->admin->dir_temp.'/file2.csv');
// To test a move that should work with forced mask
$result=dol_move($conf->admin->dir_temp.'/file2.csv',$conf->admin->dir_temp.'/file3.csv','0754',1); // file shoutld be rwxr-wr--
print __METHOD__." result=".$result."\n";
$this->assertTrue($result,'move with forced mask');
// To test a delete that should success
$result=dol_delete_file($conf->admin->dir_temp.'/file3.csv');
print __METHOD__." result=".$result."\n";
$this->assertTrue($result,'delete file');
// Again to test there is error when deleting a non existing file with option disableglob
$result=dol_delete_file($conf->admin->dir_temp.'/file2.csv',1,1);
$result=dol_delete_file($conf->admin->dir_temp.'/file3.csv',1,1);
print __METHOD__." result=".$result."\n";
$this->assertFalse($result,'delete file that does not exists with disableglo must return ko');
// Again to test there is no error when deleting a non existing file without option disableglob
$result=dol_delete_file($conf->admin->dir_temp.'/file2.csv',0,1);
$result=dol_delete_file($conf->admin->dir_temp.'/file3csv',0,1);
print __METHOD__." result=".$result."\n";
$this->assertTrue($result,'delete file that does not exists without disabling glob must return ok');