From fd9619f4cd7794e7fd2ff1ffc7e7ff01e6c4b9a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Oct 2011 18:48:19 +0200 Subject: [PATCH] Fix: Property not loaded Enhance phpunit --- htdocs/societe/class/societe.class.php | 18 +++++++++++------- test/phpunit/SocieteTest.php | 8 ++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 38a6635312b..ccb94dd5bc0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -150,7 +150,6 @@ class Societe extends CommonObject $this->db = $DB; - $this->id = $id; $this->client = 0; $this->prospect = 0; $this->fournisseur = 0; @@ -720,12 +719,12 @@ class Societe extends CommonObject $this->parent = $obj->parent; - $this->siren = $obj->siren; // TODO obsolete - $this->idprof1 = $obj->siren; - $this->siret = $obj->siret; // TODO obsolete - $this->idprof2 = $obj->siret; - $this->ape = $obj->ape; // TODO obsolete - $this->idprof3 = $obj->ape; + $this->siren = $obj->idprof1; // TODO obsolete + $this->idprof1 = $obj->idprof1; + $this->siret = $obj->idprof2; // TODO obsolete + $this->idprof2 = $obj->idprof2; + $this->ape = $obj->idprof3; // TODO obsolete + $this->idprof3 = $obj->idprof3; $this->idprof4 = $obj->idprof4; $this->capital = $obj->capital; @@ -2521,6 +2520,11 @@ class Societe extends CommonObject $this->tva_intra='EU1234567'; $this->note_public='This is a comment (public)'; $this->note='This is a comment (private)'; + + $this->idprof1='idprof1'; + $this->idprof2='idprof2'; + $this->idprof3='idprof3'; + $this->idprof4='idprof4'; } } diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 738bb8d35c6..d61d3f26a66 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -177,6 +177,10 @@ class SocieteTest extends PHPUnit_Framework_TestCase $localobject->fax='New fax'; $localobject->email='New email'; $localobject->url='New url'; + $localobject->idprof1='new idprof1'; + $localobject->idprof2='new idprof2'; + $localobject->idprof3='new idprof3'; + $localobject->idprof4='new idprof4'; $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); @@ -203,6 +207,10 @@ class SocieteTest extends PHPUnit_Framework_TestCase $this->assertEquals($localobject->fax, $newobject->fax); $this->assertEquals($localobject->email, $newobject->email); $this->assertEquals($localobject->url, $newobject->url); + $this->assertEquals($localobject->idprof1, $newobject->idprof1); + $this->assertEquals($localobject->idprof2, $newobject->idprof2); + $this->assertEquals($localobject->idprof3, $newobject->idprof3); + $this->assertEquals($localobject->idprof4, $newobject->idprof4); return $localobject; }