diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fad26472892..d7399da1a40 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1075,8 +1075,9 @@ abstract class CommonObject /** * Update public note of element - * @param note_public New value for note - * @return int <0 if KO, >0 if OK + * + * @param string $note_public New value for note + * @return int <0 if KO, >0 if OK */ function update_note_public($note_public) { @@ -1562,8 +1563,8 @@ abstract class CommonObject } else return 0; } - - + + /** * Function to check if an object is used by others * @@ -1609,7 +1610,7 @@ abstract class CommonObject } else return 0; } - + // -------------------- // TODO: All functions here must be redesigned and moved as they are not business functions but output functions @@ -1619,7 +1620,7 @@ abstract class CommonObject /** * * Enter description here ... - * + * * @param unknown_type $objectid * @param unknown_type $objecttype * @param unknown_type $withpicto diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 393b50d9363..738bb8d35c6 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -167,9 +167,42 @@ class SocieteTest extends PHPUnit_Framework_TestCase $db=$this->savdb; $localobject->note='New note after update'; - $result=$localobject->update($localobject->id,$user); + //$localobject->note_public='New note public after update'; + $localobject->name='New name'; + $localobject->address='New address'; + $localobject->zip='New zip'; + $localobject->town='New town'; + $localobject->status=0; + $localobject->tel='New tel'; + $localobject->fax='New fax'; + $localobject->email='New email'; + $localobject->url='New url'; + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); + $result=$localobject->update_note($localobject->note); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + //$result=$localobject->update_note_public($localobject->note_public); + //print __METHOD__." id=".$localobject->id." result=".$result."\n"; + //$this->assertLessThan($result, 0); + + $newobject=new Societe($this->savdb); + $result=$newobject->fetch($localobject->id); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + + $this->assertEquals($localobject->note, $newobject->note); + //$this->assertEquals($localobject->note_public, $newobject->note_public); + $this->assertEquals($localobject->name, $newobject->name); + $this->assertEquals($localobject->address, $newobject->address); + $this->assertEquals($localobject->zip, $newobject->zip); + $this->assertEquals($localobject->town, $newobject->town); + $this->assertEquals($localobject->status, $newobject->status); + $this->assertEquals($localobject->tel, $newobject->tel); + $this->assertEquals($localobject->fax, $newobject->fax); + $this->assertEquals($localobject->email, $newobject->email); + $this->assertEquals($localobject->url, $newobject->url); return $localobject; } @@ -208,7 +241,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase $result=$localobject->getFullAddress(); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertContains('MyTown', $result); + $this->assertContains("New address\nNew zip New town", $result); $result=$localobject->isInEEC(); print __METHOD__." id=".$localobject->id." pays_code=".$this->pays_code." result=".$result."\n";