Allow see project build status in cctray xml format

Refactoring is done for BuildStatus information.
- Fixed all phpcs, phpmd errors
- Added test for my code (hurray 100 tests already :D)

Closed #705
This commit is contained in:
Vaidas Zilionis 2014-12-14 17:47:46 +02:00 committed by Tobias van Beek
commit 8fc4c51d54
4 changed files with 514 additions and 3 deletions

View file

@ -107,6 +107,27 @@ class BuildStore extends BuildStoreBase
}
}
/**
* Returns all registered branches for project
*
* @param $projectId
* @return array
* @throws \Exception
*/
public function getBuildBranches($projectId)
{
$query = 'SELECT DISTINCT `branch` FROM `build` WHERE `project_id` = :project_id';
$stmt = Database::getConnection('read')->prepare($query);
$stmt->bindValue(':project_id', $projectId);
if ($stmt->execute()) {
$res = $stmt->fetchAll(\PDO::FETCH_COLUMN);
return $res;
} else {
return array();
}
}
/**
* Return build metadata by key, project and optionally build id.
* @param $key