mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: PHPUnit
This commit is contained in:
parent
eead2977d9
commit
67052933ca
|
|
@ -3002,7 +3002,8 @@ class Facture extends CommonInvoice
|
|||
$this->total_tva += $line->total_tva;
|
||||
$this->total_ttc += $line->total_ttc;
|
||||
}
|
||||
|
||||
$this->revenuestamp = 0;
|
||||
|
||||
// Add a line "offered"
|
||||
$line=new FactureLigne($this->db);
|
||||
$line->desc=$langs->trans("Description")." (offered line)";
|
||||
|
|
|
|||
|
|
@ -1413,7 +1413,12 @@ abstract class CommonObject
|
|||
dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (! in_array($suffix,array('','_public','_private')))
|
||||
{
|
||||
dol_syslog(get_class($this)."::upate_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL");
|
||||
$sql.= " WHERE rowid =". $this->id;
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||
$newlangs5=new Translate("",$conf);
|
||||
$newlangs5->setDefaultLang('ru_RU');
|
||||
$localobject->modelpdf='crabe';
|
||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs);
|
||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs5);
|
||||
$this->assertLessThan($result, 0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$conf->fichinter->dir_output.='/temp';
|
||||
$conf->ficheinter->dir_output.='/temp';
|
||||
$localobject=new Fichinter($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
|
||||
|
|
|
|||
|
|
@ -210,9 +210,9 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
|||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Contact::update error');
|
||||
|
||||
$result=$localobject->update_note_private($localobject->note_private);
|
||||
$result=$localobject->update_note($localobject->note_private,'_private');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Contact::update_note_private error');
|
||||
$this->assertLessThan($result, 0, 'Contact::update_note error');
|
||||
|
||||
$result=$localobject->update_note_public($localobject->note_public);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
|
|
@ -223,8 +223,8 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
|||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Contact::fetch error');
|
||||
|
||||
print __METHOD__." old=".$localobject->note." new=".$newobject->note."\n";
|
||||
$this->assertEquals($localobject->note, $newobject->note);
|
||||
print __METHOD__." old=".$localobject->note_private." new=".$newobject->note_private."\n";
|
||||
$this->assertEquals($localobject->note_private, $newobject->note_private);
|
||||
//print __METHOD__." old=".$localobject->note_public." new=".$newobject->note_public."\n";
|
||||
//$this->assertEquals($localobject->note_public, $newobject->note_public);
|
||||
print __METHOD__." old=".$localobject->lastname." new=".$newobject->lastname."\n";
|
||||
|
|
|
|||
|
|
@ -312,35 +312,35 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
$result=dol_copy($file, '/adir/that/does/not/exists/file.csv');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertLessThan(0,$result); // We should have error
|
||||
$this->assertLessThan(0,$result,'copy dir that does not exists'); // We should have error
|
||||
|
||||
$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 into a dir that exists'); // Should be 1
|
||||
|
||||
// Again to test with overwriting=0
|
||||
$result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(0,$result); // Should be 0
|
||||
$this->assertEquals(0,$result, 'copy destination already exists, no overwrite'); // Should be 0
|
||||
|
||||
// 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 eists, 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);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue($result,'copy destination does not exists');
|
||||
|
||||
$result=dol_delete_file($conf->admin->dir_temp.'/file2.csv');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue($result,'delete file');
|
||||
|
||||
// Again to test no erreor when deleteing a non existing 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->assertTrue($result);
|
||||
$this->assertTrue($result,'delete file that does not exists');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -204,9 +204,9 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
|||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update error');
|
||||
|
||||
$result=$localobject->update_note_private($localobject->note_private);
|
||||
$result=$localobject->update_note($localobject->note_private,'_private');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note_private error');
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note error');
|
||||
|
||||
$result=$localobject->update_note_public($localobject->note_public);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ class PdfDocTest extends PHPUnit_Framework_TestCase
|
|||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->lines=array();
|
||||
$localobject->lines[0]=new FactureLigne($this->savdb);
|
||||
$localobject->lines[0]->fk_product=1;
|
||||
$localobject->lines[0]->label='Label 1';
|
||||
$localobject->lines[0]->desc="This is a description with a é accent\n(Country of origin: France)";
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
|
|||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
$result=$localobject->update_note_private($localobject->note_private);
|
||||
$result=$localobject->update_note($localobject->note_private,'_private');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note_private error');
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
|
|||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
$this->assertEquals($localobject->note, $newobject->note);
|
||||
$this->assertEquals($localobject->note_private, $newobject->note_private);
|
||||
//$this->assertEquals($localobject->note_public, $newobject->note_public);
|
||||
$this->assertEquals($localobject->name, $newobject->name);
|
||||
$this->assertEquals($localobject->address, $newobject->address);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user