More service layer functionality, builds now. Also some extra tests for projects and build models.
This commit is contained in:
parent
9a51a1458e
commit
3fd1bc2a36
9 changed files with 602 additions and 42 deletions
|
|
@ -20,6 +20,7 @@ use PHPCI\Helper\Github;
|
|||
use PHPCI\Helper\SshKey;
|
||||
use PHPCI\Model\Build;
|
||||
use PHPCI\Model\Project;
|
||||
use PHPCI\Service\BuildService;
|
||||
use PHPCI\Service\ProjectService;
|
||||
|
||||
/**
|
||||
|
|
@ -30,11 +31,6 @@ use PHPCI\Service\ProjectService;
|
|||
*/
|
||||
class ProjectController extends \PHPCI\Controller
|
||||
{
|
||||
/**
|
||||
* @var \PHPCI\Store\BuildStore
|
||||
*/
|
||||
protected $buildStore;
|
||||
|
||||
/**
|
||||
* @var \PHPCI\Store\ProjectStore
|
||||
*/
|
||||
|
|
@ -45,11 +41,22 @@ class ProjectController extends \PHPCI\Controller
|
|||
*/
|
||||
protected $projectService;
|
||||
|
||||
/**
|
||||
* @var \PHPCI\Store\BuildStore
|
||||
*/
|
||||
protected $buildStore;
|
||||
|
||||
/**
|
||||
* @var \PHPCI\Service\BuildService
|
||||
*/
|
||||
protected $buildService;
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->buildStore = Store\Factory::getStore('Build');
|
||||
$this->projectStore = Store\Factory::getStore('Project');
|
||||
$this->projectService = new ProjectService($this->projectStore);
|
||||
$this->buildService = new BuildService($this->buildStore);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,15 +102,7 @@ class ProjectController extends \PHPCI\Controller
|
|||
throw new NotFoundException('Project with id: ' . $projectId . ' not found');
|
||||
}
|
||||
|
||||
$build = new Build();
|
||||
$build->setProjectId($projectId);
|
||||
$build->setCommitId('Manual');
|
||||
$build->setStatus(Build::STATUS_NEW);
|
||||
$build->setBranch($project->getBranch());
|
||||
$build->setCreated(new \DateTime());
|
||||
$build->setCommitterEmail($_SESSION['user']->getEmail());
|
||||
|
||||
$build = $this->buildStore->save($build);
|
||||
$build = $this->buildService->createBuild($project, null, null, $_SESSION['user']->getEmail());
|
||||
|
||||
header('Location: '.PHPCI_URL.'build/view/' . $build->getId());
|
||||
exit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue