+ Add unit test case for mr->logMergedAction.

This commit is contained in:
caoyanyi
2023-12-21 15:03:52 +08:00
parent e1a8fd5834
commit 4ecd431f94
2 changed files with 51 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php
/**
title=测试 mrModel::logMergedAction();
timeout=0
cid=0
- 没有关联的对象
- 属性id @1
- 属性objectType @mr
- 属性objectID @2
- 有关联的对象
- 属性id @7
- 属性objectType @task
- 属性objectID @2
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/mr.class.php';
su('admin');
zdTable('action')->gen(0);
zdTable('pipeline')->gen(5);
zdTable('product')->gen(5);
zdTable('repo')->config('repo')->gen(5);
zdTable('relation')->config('relation')->gen(5);
zdTable('mr')->config('mr')->gen(5);
$mrModel = new mrTest();
r($mrModel->logMergedActionTester(2)) && p('id,objectType,objectID') && e('1,mr,2'); // 没有关联的对象
r($mrModel->logMergedActionTester(1)) && p('id,objectType,objectID') && e('7,task,2'); // 有关联的对象
+16
View File
@@ -393,4 +393,20 @@ class mrTest
$MR = $this->objectModel->fetchByID($MRID);
return $this->objectModel->getMRProduct($MR);
}
/**
* Test logMergedAction method.
*
* @param int $MRID
* @access public
* @return array|object|false
*/
public function logMergedActionTester(int $MRID): array|object|false
{
$MR = $this->objectModel->fetchByID($MRID);
$this->objectModel->logMergedAction($MR);
if(dao::isError()) return dao::getError();
return $this->objectModel->dao->select('*')->from(TABLE_ACTION)->orderBy('id_desc')->fetch();
}
}