diff --git a/module/tutorial/test/lib/tutorial.unittest.class.php b/module/tutorial/test/lib/tutorial.unittest.class.php index 18d8fe252e..80ea9e8a32 100644 --- a/module/tutorial/test/lib/tutorial.unittest.class.php +++ b/module/tutorial/test/lib/tutorial.unittest.class.php @@ -1334,4 +1334,18 @@ class tutorialTest return $result; } + + /** + * Test getCommits method. + * + * @access public + * @return array + */ + public function getCommitsTest(): array + { + $result = $this->objectModel->getCommits(); + if(dao::isError()) return dao::getError(); + + return $result; + } } diff --git a/module/tutorial/test/model/getcommits.php b/module/tutorial/test/model/getcommits.php new file mode 100755 index 0000000000..8252bf91e3 --- /dev/null +++ b/module/tutorial/test/model/getcommits.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +getCommitsTest())) && p() && e('1'); // 步骤1:验证返回数组长度为1 +r($tutorialTest->getCommitsTest()) && p('bedeaaf39ef7084b9a455b9d9dba71e2db357201:id') && e('1'); // 步骤2:验证提交记录ID +r($tutorialTest->getCommitsTest()) && p('bedeaaf39ef7084b9a455b9d9dba71e2db357201:repo') && e('1'); // 步骤3:验证代码库ID +r($tutorialTest->getCommitsTest()) && p('bedeaaf39ef7084b9a455b9d9dba71e2db357201:committer') && e('admin'); // 步骤4:验证提交者 +r($tutorialTest->getCommitsTest()) && p('bedeaaf39ef7084b9a455b9d9dba71e2db357201:comment') && e('Git comment.'); // 步骤5:验证提交注释 \ No newline at end of file