From f747371c6ddf1d4326cdfb7260b08037fd9aef4e Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Fri, 9 Oct 2015 10:29:21 +0100 Subject: [PATCH] Fixing tests #2 --- PHPCI/Model/Build.php | 13 ++++--------- Tests/PHPCI/Service/BuildServiceTest.php | 6 +++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/PHPCI/Model/Build.php b/PHPCI/Model/Build.php index 9374b763..2f2b64cc 100644 --- a/PHPCI/Model/Build.php +++ b/PHPCI/Model/Build.php @@ -30,11 +30,6 @@ class Build extends BuildBase public $currentBuildPath = null; - /** - * @var \PHPCI\Model\Project $project - */ - protected $project; - /** * Get link to commit from another source (i.e. Github) */ @@ -260,7 +255,7 @@ class Build extends BuildBase */ public function setProjectObject(\PHPCI\Model\Project $value) { - $this->project = $value; + $this->data['project'] = $value; return parent::setProjectObject($value); } @@ -269,10 +264,10 @@ class Build extends BuildBase */ public function getProject() { - if (empty($this->project)) { - $this->project = parent::getProject(); + if (empty($this->data['project'])) { + $this->data['project'] = parent::getProject(); } - return $this->project; + return $this->data['project']; } } diff --git a/Tests/PHPCI/Service/BuildServiceTest.php b/Tests/PHPCI/Service/BuildServiceTest.php index 985f3088..4a396334 100644 --- a/Tests/PHPCI/Service/BuildServiceTest.php +++ b/Tests/PHPCI/Service/BuildServiceTest.php @@ -101,9 +101,13 @@ class BuildServiceTest extends \PHPUnit_Framework_TestCase */ public function testExecute_CreateDuplicateBuild() { + $project = new Project(); + $project->setType('hg'); + $project->setId(101); + $build = new Build(); $build->setId(1); - $build->setProjectId(101); + $build->setProject($project); $build->setCommitId('abcde'); $build->setStatus(Build::STATUS_FAILED); $build->setLog('Test');