Merge pull request #23118 from Hystepik/develop#1

Fix : KnowledgeRecordTest add fetch and update
This commit is contained in:
Laurent Destailleur 2022-12-06 18:58:48 +01:00 committed by GitHub
commit 418d7c876e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,13 +175,63 @@ class KnowledgeRecordTest extends PHPUnit\Framework\TestCase
return $result;
}
/**
* testKnowledgeRecordFetch
*
* @param int $id Id order
* @return KnowledgeRecord
*
* @depends testKnowledgeRecordCreate
* The depends says test is run only if previous is ok
*/
public function testKnowledgeRecordFetch($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new KnowledgeRecord($this->savdb);
$result=$localobject->fetch($id);
$this->assertLessThan($result, 0);
print __METHOD__." id=".$id." result=".$result."\n";
return $localobject;
}
/**
* testKnowledgeRecordUpdate
* @param KnowledgeRecord $localobject KnowledgeRecord
* @return int
*
* @depends testKnowledgeRecordFetch
* The depends says test is run only if previous is ok
*/
public function testKnowledgeRecordUpdate($localobject)
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
$localobject->note_private='New note private after update';
$result = $localobject->update($user);
$this->assertLessThan($result, 0);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
return $result;
}
/**
* testKnowledgeRecordDelete
*
* @param int $id Id of object
* @return int
*
* @depends testKnowledgeRecordCreate
* @depends testKnowledgeRecordUpdate
* The depends says test is run only if previous is ok
*/
public function testKnowledgeRecordDelete($id)