Skip to content

Commit 8b94a99

Browse files
committedMar 7, 2025·
Fix contract update method. Add phpunit for TDD.
1 parent ae19615 commit 8b94a99

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed
 

‎test/phpunit/ContratTest.php

+28-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,33 @@ public function testContratOther($localobject)
130130
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
131131
$this->assertNotEquals($localobject->date_creation, '');
132132

133-
return $localobject->id;
133+
return $localobject;
134+
}
135+
136+
/**
137+
* testContratUpdate
138+
*
139+
* @param Contrat $localobject Object contract
140+
* @return int
141+
*
142+
* @depends testContratOther
143+
* The depends says test is run only if previous is ok
144+
*/
145+
public function testContratUpdate($localobject)
146+
{
147+
global $conf,$user,$langs,$db;
148+
$conf = $this->savconf;
149+
$user = $this->savuser;
150+
$langs = $this->savlangs;
151+
$db = $this->savdb;
152+
153+
$localobject->note_private = 'New private note';
154+
155+
$result = $localobject->update($user);
156+
157+
print __METHOD__." id=".$localobject->id." result=".$result."\n";
158+
$this->assertLessThan($result, 0);
159+
return $result;
134160
}
135161

136162
/**
@@ -139,7 +165,7 @@ public function testContratOther($localobject)
139165
* @param int $id Id of contract
140166
* @return int
141167
*
142-
* @depends testContratOther
168+
* @depends testContratUpdate
143169
* The depends says test is run only if previous is ok
144170
*/
145171
public function testContratDelete($id)

0 commit comments

Comments
 (0)
Please sign in to comment.