znt/module/git/test/model/getrepologs.php

39 lines
1.2 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试gitModel->getRepoLogs();
timeout=0
cid=16546
- 分支名为空,返回默认分支的日志
- 属性revision @b362ea7aa65515dc35ff3a93423478b2143e771d
- 属性msg @Initial commit
- 分支名为test1返回空数组属性revision @~~
- 分支名为test1000返回主干的日志
- 属性revision @b362ea7aa65515dc35ff3a93423478b2143e771d
- 属性msg @Initial commit
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
zenData('pipeline')->gen(1);
zenData('repo')->loadYaml('repo')->gen(1);
su('admin');
$git = new gitModelTest();
$repoID = 1;
$branch = '';
$result = $git->getRepoLogs($repoID, $branch);
r(end($result)) && p('revision,msg') && e('b362ea7aa65515dc35ff3a93423478b2143e771d,Initial commit'); // 分支名为空,返回默认分支的日志
$branch = 'test1';
r($git->getRepoLogs($repoID, $branch)) && p('revision') && e('~~'); // 分支名为test1返回空数组
$branch = 'test1000';
$result = $git->getRepoLogs($repoID, $branch);
r(end($result)) && p('revision,msg') && e('b362ea7aa65515dc35ff3a93423478b2143e771d,Initial commit'); // 分支名为test1000返回主干的日志