From e22b0b9a5706981cb5fd11b2d7e9feec4f440ec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Oct 2015 22:36:32 +0200 Subject: [PATCH] More complete PHPunit test --- test/phpunit/FilesLibTest.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index e9fb713b857..b9f334315e6 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -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');