瀏覽代碼

FIx : KnowledgeRecordTest

hystepik 2 年之前
父節點
當前提交
d676dab136
共有 1 個文件被更改,包括 51 次插入1 次删除
  1. 51 1
      test/phpunit/KnowledgeRecordTest.php

+ 51 - 1
test/phpunit/KnowledgeRecordTest.php

@@ -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)