+ Add unit test case for git->run.
This commit is contained in:
@@ -24,66 +24,6 @@ class gitTest
|
||||
return $this->gitModel->dao->select('*')->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->orderBy('id_desc')->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repos.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setRepos()
|
||||
{
|
||||
$this->gitModel->setRepos();
|
||||
$repo = array_shift($this->gitModel->repos);
|
||||
return $repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repos.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getRepos()
|
||||
{
|
||||
$pairs = $this->gitModel->getRepos();
|
||||
return array_shift($pairs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set repo.
|
||||
*
|
||||
* @param object $repo
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setRepo($repo)
|
||||
{
|
||||
$this->gitModel->client = '';
|
||||
$this->gitModel->repoRoot = '';
|
||||
|
||||
$result = $this->gitModel->setRepo($repo);
|
||||
|
||||
$data = new stdclass();
|
||||
$data->result = $result;
|
||||
$data->client = !empty($this->gitModel->client);
|
||||
$data->repoRoot = !empty($this->gitModel->repoRoot);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* get tags histories for repo.
|
||||
*
|
||||
* @param object $repo
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getRepoTags($repo)
|
||||
{
|
||||
$tags = $this->gitModel->getRepoTags($repo);
|
||||
if(is_array($tags) and count($tags) >= 1) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repo logs.
|
||||
*
|
||||
@@ -97,4 +37,20 @@ class gitTest
|
||||
$repo = $this->gitModel->loadModel('repo')->getByID($repoID);
|
||||
return $this->gitModel->getRepoLogs($repo, $branch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test run method.
|
||||
*
|
||||
* @access public
|
||||
* @return object|bool
|
||||
*/
|
||||
public function runTest(): object|bool
|
||||
{
|
||||
ob_start();
|
||||
$this->gitModel->run();
|
||||
ob_get_clean();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $this->gitModel->dao->select('*')->from(TABLE_REPOHISTORY)->where('id')->eq(2)->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user