+ Add unit test case for gitlab->getFileLastCommit.

This commit is contained in:
caoyanyi
2024-01-11 17:28:49 +08:00
parent 893c35d044
commit e50ff3f699
2 changed files with 45 additions and 18 deletions
+17
View File
@@ -411,4 +411,21 @@ class gitlabTest
if(isset($result->errors)) return array_column($result->errors, 'message');
return $result->data->project->repository->tree;
}
/**
* Test getFileLastCommit method.
*
* @param string $path
* @param string $branch
* @access public
* @return object|null|array
*/
public function getFileLastCommitTest(string $path, string $branch): object|array|null
{
$repo = $this->gitlab->loadModel('repo')->getByID(1);
$result = $this->gitlab->getFileLastCommit($repo, $path, $branch);
if(!$result) return $result;
if(isset($result->errors)) return array_column($result->errors, 'message');
return $result;
}
}