Skip to content

Commit

Permalink
More complete PHPunit test
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 14, 2015
1 parent 00c8b27 commit e22b0b9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/phpunit/FilesLibTest.php
Expand Up @@ -330,22 +330,28 @@ public function testDolCopyMoveDelete()
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');

// 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');

$result=dol_delete_file($conf->admin->dir_temp.'/file2.csv');
// 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');

Expand Down

0 comments on commit e22b0b9

Please sign in to comment.