2
0
forked from Wavyzz/dolibarr

Fix contract update method. Add phpunit for TDD.

This commit is contained in:
ldestailleur
2025-03-07 16:02:18 +01:00
parent ae196154af
commit 8b94a99dd1

View File

@@ -130,7 +130,33 @@ class ContratTest extends CommonClassTest
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
$this->assertNotEquals($localobject->date_creation, '');
return $localobject->id;
return $localobject;
}
/**
* testContratUpdate
*
* @param Contrat $localobject Object contract
* @return int
*
* @depends testContratOther
* The depends says test is run only if previous is ok
*/
public function testContratUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
$localobject->note_private = 'New private note';
$result = $localobject->update($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
/**
@@ -139,7 +165,7 @@ class ContratTest extends CommonClassTest
* @param int $id Id of contract
* @return int
*
* @depends testContratOther
* @depends testContratUpdate
* The depends says test is run only if previous is ok
*/
public function testContratDelete($id)