Added 'user_id' column to 'build' table (created by)
+ Renamed columns 'created' -> 'create_date', 'started' -> 'start_date' and 'finished' -> 'finish_date' + Code style fixes.
This commit is contained in:
parent
58b23fe89d
commit
4ec6d854c2
|
@ -30,8 +30,8 @@ var Build = Class.extend({
|
|||
|
||||
if (self.buildData) {
|
||||
$('.build-duration').html(self.buildData.duration ? (self.buildData.duration + ' ' + Lang.get('seconds')) : ('0 ' + Lang.get('seconds')));
|
||||
$('.build-started').html(self.buildData.started ? self.buildData.started : '');
|
||||
$('.build-finished').html(self.buildData.finished ? self.buildData.finished : '');
|
||||
$('.build-started').html(self.buildData.start_date ? self.buildData.start_date : '');
|
||||
$('.build-finished').html(self.buildData.finish_date ? self.buildData.finish_date : '');
|
||||
$('#log pre').html(self.buildData.log);
|
||||
$('.errors-table tbody').html(self.buildData.error_html);
|
||||
|
||||
|
|
|
@ -76,8 +76,9 @@ class Model
|
|||
|
||||
$rtn = $childArray;
|
||||
} else {
|
||||
$rtn = (is_string($value) && !mb_check_encoding($value, 'UTF-8')) ? mb_convert_encoding($value,
|
||||
'UTF-8') : $value;
|
||||
$rtn = (is_string($value) && !mb_check_encoding($value, 'UTF-8'))
|
||||
? mb_convert_encoding($value, 'UTF-8')
|
||||
: $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +122,7 @@ class Model
|
|||
protected function validateString($name, $value)
|
||||
{
|
||||
if (!is_string($value) && !is_null($value)) {
|
||||
throw new HttpException\ValidationException($name . ' must be a string.');
|
||||
throw new HttpException\ValidationException('Column "', $name . '" must be a string.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +133,7 @@ class Model
|
|||
}
|
||||
|
||||
if (!is_numeric($value) && !is_null($value)) {
|
||||
throw new HttpException\ValidationException($name . ' must be an integer.');
|
||||
throw new HttpException\ValidationException('Column "', $name . '" must be an integer.');
|
||||
}
|
||||
|
||||
if (!is_int($value) && !is_null($value)) {
|
||||
|
@ -143,7 +144,7 @@ class Model
|
|||
protected function validateFloat($name, &$value)
|
||||
{
|
||||
if (!is_numeric($value) && !is_null($value)) {
|
||||
throw new HttpException\ValidationException($name . ' must be a float.');
|
||||
throw new HttpException\ValidationException('Column "', $name . '" must be a float.');
|
||||
}
|
||||
|
||||
if (!is_float($value) && !is_null($value)) {
|
||||
|
@ -158,17 +159,16 @@ class Model
|
|||
}
|
||||
|
||||
if ((!is_object($value) || !($value instanceof \DateTime)) && !is_null($value)) {
|
||||
throw new HttpException\ValidationException($name . ' must be a date object.');
|
||||
throw new HttpException\ValidationException('Column "', $name . '" must be a date object.');
|
||||
}
|
||||
|
||||
|
||||
$value = empty($value) ? null : $value->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
protected function validateNotNull($name, &$value)
|
||||
protected function validateNotNull($name, $value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
throw new HttpException\ValidationException($name . ' must not be null.');
|
||||
throw new HttpException\ValidationException('Column "', $name . '" must not be null.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ class Builder implements LoggerAwareInterface
|
|||
}
|
||||
|
||||
// Update the build in the database, ping any external services.
|
||||
$this->build->setStarted(new \DateTime());
|
||||
$this->build->setStartDate(new \DateTime());
|
||||
$this->store->save($this->build);
|
||||
$this->build->sendStatusPostback();
|
||||
$success = true;
|
||||
|
@ -256,7 +256,7 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
// Update the build in the database, ping any external services, etc.
|
||||
$this->build->sendStatusPostback();
|
||||
$this->build->setFinished(new \DateTime());
|
||||
$this->build->setFinishDate(new \DateTime());
|
||||
|
||||
$removeBuilds = (bool)Config::getInstance()->get('php-censor.build.remove_builds', true);
|
||||
if ($removeBuilds) {
|
||||
|
|
|
@ -114,7 +114,7 @@ class RunCommand extends Command
|
|||
$this->logger->addError($ex->getMessage());
|
||||
|
||||
$build->setStatus(Build::STATUS_FAILED);
|
||||
$build->setFinished(new \DateTime());
|
||||
$build->setFinishDate(new \DateTime());
|
||||
$build->setLog($build->getLog() . PHP_EOL . PHP_EOL . $ex->getMessage());
|
||||
$buildStore->save($build);
|
||||
$build->sendStatusPostback();
|
||||
|
@ -154,12 +154,12 @@ class RunCommand extends Command
|
|||
$build = BuildFactory::getBuild($build);
|
||||
|
||||
$now = time();
|
||||
$start = $build->getStarted()->getTimestamp();
|
||||
$start = $build->getStartDate()->getTimestamp();
|
||||
|
||||
if (($now - $start) > $timeout) {
|
||||
$this->logger->addInfo(sprintf('Build %d marked as failed due to timeout.', $build->getId()));
|
||||
$build->setStatus(Build::STATUS_FAILED);
|
||||
$build->setFinished(new \DateTime());
|
||||
$build->setFinishDate(new \DateTime());
|
||||
$store->save($build);
|
||||
$build->removeBuildDirectory();
|
||||
continue;
|
||||
|
|
|
@ -83,7 +83,7 @@ class ScheduleBuildCommand extends Command
|
|||
// If it's running or just created, we don't want to reschedule already.
|
||||
continue;
|
||||
}
|
||||
if ($date < $build->getFinished()) {
|
||||
if ($date < $build->getFinishDate()) {
|
||||
// If finished date is newer then the specified since days, we don't want to reschedule
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -125,20 +125,20 @@ class BuildController extends Controller
|
|||
*/
|
||||
protected function getBuildData(Build $build)
|
||||
{
|
||||
$data = [];
|
||||
$data['status'] = (int)$build->getStatus();
|
||||
$data['log'] = $this->cleanLog($build->getLog());
|
||||
$data['created'] = !is_null($build->getCreated()) ? $build->getCreated()->format('Y-m-d H:i:s') : null;
|
||||
$data['started'] = !is_null($build->getStarted()) ? $build->getStarted()->format('Y-m-d H:i:s') : null;
|
||||
$data['finished'] = !is_null($build->getFinished()) ? $build->getFinished()->format('Y-m-d H:i:s') : null;
|
||||
$data['duration'] = $build->getDuration();
|
||||
$data = [];
|
||||
$data['status'] = (int)$build->getStatus();
|
||||
$data['log'] = $this->cleanLog($build->getLog());
|
||||
$data['create_date'] = !is_null($build->getCreateDate()) ? $build->getCreateDate()->format('Y-m-d H:i:s') : null;
|
||||
$data['start_date'] = !is_null($build->getStartDate()) ? $build->getStartDate()->format('Y-m-d H:i:s') : null;
|
||||
$data['finish_date'] = !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : null;
|
||||
$data['duration'] = $build->getDuration();
|
||||
|
||||
/** @var \PHPCensor\Store\BuildErrorStore $errorStore */
|
||||
$errorStore = b8\Store\Factory::getStore('BuildError');
|
||||
$errors = $errorStore->getErrorsForBuild($build->getId());
|
||||
|
||||
$errorView = new b8\View('Build/errors');
|
||||
$errorView->build = $build;
|
||||
$errorView = new b8\View('Build/errors');
|
||||
$errorView->build = $build;
|
||||
$errorView->errors = $errors;
|
||||
|
||||
$data['errors'] = $errorStore->getErrorTotalForBuild($build->getId());
|
||||
|
|
|
@ -173,16 +173,18 @@ class ProjectController extends PHPCensor\Controller
|
|||
];
|
||||
}
|
||||
|
||||
$email = $_SESSION['php-censor-user']->getEmail();
|
||||
/** @var PHPCensor\Model\User $user */
|
||||
$user = $_SESSION['php-censor-user'];
|
||||
$build = $this->buildService->createBuild(
|
||||
$project,
|
||||
$environment,
|
||||
'',
|
||||
$branch,
|
||||
null,
|
||||
$email,
|
||||
$user->getEmail(),
|
||||
null,
|
||||
Build::SOURCE_MANUAL_WEB,
|
||||
$user->getId(),
|
||||
$extra
|
||||
);
|
||||
|
||||
|
|
|
@ -666,6 +666,7 @@ class WebhookController extends Controller
|
|||
$committer,
|
||||
$commitMessage,
|
||||
Build::SOURCE_WEBHOOK,
|
||||
0,
|
||||
$extra
|
||||
);
|
||||
|
||||
|
@ -704,6 +705,7 @@ class WebhookController extends Controller
|
|||
$committer,
|
||||
$commitMessage,
|
||||
Build::SOURCE_WEBHOOK,
|
||||
0,
|
||||
$extra
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class AddedAdditionalColumns extends AbstractMigration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$table = $this->table('build');
|
||||
|
||||
if (!$table->hasColumn('user_id')) {
|
||||
$table
|
||||
->addColumn('user_id', 'integer', ['default' => 0])
|
||||
->save();
|
||||
}
|
||||
|
||||
$table = $this->table('build');
|
||||
|
||||
if ($table->hasColumn('created')) {
|
||||
$table
|
||||
->renameColumn('created', 'create_date')
|
||||
->save();
|
||||
}
|
||||
|
||||
if ($table->hasColumn('started')) {
|
||||
$table
|
||||
->renameColumn('started', 'start_date')
|
||||
->save();
|
||||
}
|
||||
|
||||
if ($table->hasColumn('finished')) {
|
||||
$table
|
||||
->renameColumn('finished', 'finish_date')
|
||||
->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$table = $this->table('build');
|
||||
|
||||
if ($table->hasColumn('user_id')) {
|
||||
$table
|
||||
->removeColumn('user_id')
|
||||
->save();
|
||||
}
|
||||
|
||||
$table = $this->table('build');
|
||||
|
||||
if ($table->hasColumn('create_date')) {
|
||||
$table
|
||||
->renameColumn('create_date', 'created')
|
||||
->save();
|
||||
}
|
||||
|
||||
if ($table->hasColumn('start_date')) {
|
||||
$table
|
||||
->renameColumn('start_date', 'started')
|
||||
->save();
|
||||
}
|
||||
|
||||
if ($table->hasColumn('finish_date')) {
|
||||
$table
|
||||
->renameColumn('finish_date', 'finished')
|
||||
->save();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,10 +21,10 @@ class Build extends Model
|
|||
const STAGE_FIXED = 'fixed';
|
||||
const STAGE_BROKEN = 'broken';
|
||||
|
||||
const STATUS_PENDING = 0;
|
||||
const STATUS_RUNNING = 1;
|
||||
const STATUS_SUCCESS = 2;
|
||||
const STATUS_FAILED = 3;
|
||||
const STATUS_PENDING = 0;
|
||||
const STATUS_RUNNING = 1;
|
||||
const STATUS_SUCCESS = 2;
|
||||
const STATUS_FAILED = 3;
|
||||
|
||||
const SOURCE_UNKNOWN = 0;
|
||||
const SOURCE_MANUAL_WEB = 1;
|
||||
|
@ -58,14 +58,15 @@ class Build extends Model
|
|||
'log' => null,
|
||||
'branch' => null,
|
||||
'tag' => null,
|
||||
'created' => null,
|
||||
'started' => null,
|
||||
'finished' => null,
|
||||
'create_date' => null,
|
||||
'start_date' => null,
|
||||
'finish_date' => null,
|
||||
'committer_email' => null,
|
||||
'commit_message' => null,
|
||||
'extra' => null,
|
||||
'environment' => null,
|
||||
'source' => Build::SOURCE_UNKNOWN,
|
||||
'user_id' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -80,14 +81,15 @@ class Build extends Model
|
|||
'log' => 'getLog',
|
||||
'branch' => 'getBranch',
|
||||
'tag' => 'getTag',
|
||||
'created' => 'getCreated',
|
||||
'started' => 'getStarted',
|
||||
'finished' => 'getFinished',
|
||||
'create_date' => 'getCreateDate',
|
||||
'start_date' => 'getStartDate',
|
||||
'finish_date' => 'getFinishDate',
|
||||
'committer_email' => 'getCommitterEmail',
|
||||
'commit_message' => 'getCommitMessage',
|
||||
'extra' => 'getExtra',
|
||||
'environment' => 'getEnvironment',
|
||||
'source' => 'getSource',
|
||||
'user_id' => 'getUserId',
|
||||
|
||||
// Foreign key getters:
|
||||
'Project' => 'getProject',
|
||||
|
@ -105,22 +107,21 @@ class Build extends Model
|
|||
'log' => 'setLog',
|
||||
'branch' => 'setBranch',
|
||||
'setTag' => 'setTag',
|
||||
'created' => 'setCreated',
|
||||
'started' => 'setStarted',
|
||||
'finished' => 'setFinished',
|
||||
'create_date' => 'setCreateDate',
|
||||
'start_date' => 'setStartDate',
|
||||
'finish_date' => 'setFinishDate',
|
||||
'committer_email' => 'setCommitterEmail',
|
||||
'commit_message' => 'setCommitMessage',
|
||||
'extra' => 'setExtra',
|
||||
'environment' => 'setEnvironment',
|
||||
'source' => 'setSource',
|
||||
'user_id' => 'setUserId',
|
||||
|
||||
// Foreign key setters:
|
||||
'Project' => 'setProject',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
|
@ -131,134 +132,12 @@ class Build extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of ProjectId / project_id.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getProjectId()
|
||||
{
|
||||
$rtn = $this->data['project_id'];
|
||||
|
||||
return (integer)$rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of CommitId / commit_id.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitId()
|
||||
{
|
||||
$rtn = $this->data['commit_id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Status / status.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$rtn = $this->data['status'];
|
||||
|
||||
return (integer)$rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Log / log.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLog()
|
||||
{
|
||||
$rtn = $this->data['log'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Branch / branch.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBranch()
|
||||
{
|
||||
$rtn = $this->data['branch'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Created / created.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getCreated()
|
||||
{
|
||||
$rtn = $this->data['created'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Started / started.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStarted()
|
||||
{
|
||||
$rtn = $this->data['started'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Finished / finished.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getFinished()
|
||||
{
|
||||
$rtn = $this->data['finished'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of CommitterEmail / committer_email.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitterEmail()
|
||||
{
|
||||
$rtn = $this->data['committer_email'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id. Must not be null.
|
||||
*
|
||||
* @param $value int
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('Id', $value);
|
||||
$this->validateInt('Id', $value);
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
|
@ -270,14 +149,22 @@ class Build extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of ProjectId / project_id. Must not be null.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getProjectId()
|
||||
{
|
||||
$rtn = $this->data['project_id'];
|
||||
|
||||
return (integer)$rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value int
|
||||
*/
|
||||
public function setProjectId($value)
|
||||
{
|
||||
$this->validateNotNull('ProjectId', $value);
|
||||
$this->validateInt('ProjectId', $value);
|
||||
$this->validateNotNull('project_id', $value);
|
||||
$this->validateInt('project_id', $value);
|
||||
|
||||
if ($this->data['project_id'] === $value) {
|
||||
return;
|
||||
|
@ -289,14 +176,22 @@ class Build extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of CommitId / commit_id. Must not be null.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitId()
|
||||
{
|
||||
$rtn = $this->data['commit_id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitId($value)
|
||||
{
|
||||
$this->validateNotNull('CommitId', $value);
|
||||
$this->validateString('CommitId', $value);
|
||||
$this->validateNotNull('commit_id', $value);
|
||||
$this->validateString('commit_id', $value);
|
||||
|
||||
if ($this->data['commit_id'] === $value) {
|
||||
return;
|
||||
|
@ -308,14 +203,22 @@ class Build extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Status / status. Must not be null.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$rtn = $this->data['status'];
|
||||
|
||||
return (integer)$rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value int
|
||||
*/
|
||||
public function setStatus($value)
|
||||
{
|
||||
$this->validateNotNull('Status', $value);
|
||||
$this->validateInt('Status', $value);
|
||||
$this->validateNotNull('status', $value);
|
||||
$this->validateInt('status', $value);
|
||||
|
||||
if ($this->data['status'] === $value) {
|
||||
return;
|
||||
|
@ -327,15 +230,315 @@ class Build extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Status / status only if it synced with db. Must not be null.
|
||||
* @return string
|
||||
*/
|
||||
public function getLog()
|
||||
{
|
||||
$rtn = $this->data['log'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value string
|
||||
*/
|
||||
public function setLog($value)
|
||||
{
|
||||
$this->validateString('log', $value);
|
||||
|
||||
if ($this->data['log'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['log'] = $value;
|
||||
|
||||
$this->setModified('log');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBranch()
|
||||
{
|
||||
$rtn = $this->data['branch'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value string
|
||||
*/
|
||||
public function setBranch($value)
|
||||
{
|
||||
$this->validateNotNull('branch', $value);
|
||||
$this->validateString('branch', $value);
|
||||
|
||||
if ($this->data['branch'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['branch'] = $value;
|
||||
|
||||
$this->setModified('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getCreateDate()
|
||||
{
|
||||
$rtn = $this->data['create_date'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setCreateDate($value)
|
||||
{
|
||||
$this->validateDate('create_date', $value);
|
||||
|
||||
if ($this->data['create_date'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['create_date'] = $value;
|
||||
|
||||
$this->setModified('create_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
$rtn = $this->data['start_date'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setStartDate($value)
|
||||
{
|
||||
$this->validateDate('start_date', $value);
|
||||
|
||||
if ($this->data['start_date'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['start_date'] = $value;
|
||||
|
||||
$this->setModified('start_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getFinishDate()
|
||||
{
|
||||
$rtn = $this->data['finish_date'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setFinishDate($value)
|
||||
{
|
||||
$this->validateDate('finish_date', $value);
|
||||
|
||||
if ($this->data['finish_date'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['finish_date'] = $value;
|
||||
|
||||
$this->setModified('finish_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitterEmail()
|
||||
{
|
||||
$rtn = $this->data['committer_email'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitterEmail($value)
|
||||
{
|
||||
$this->validateString('committer_email', $value);
|
||||
|
||||
if ($this->data['committer_email'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['committer_email'] = $value;
|
||||
|
||||
$this->setModified('committer_email');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitMessage()
|
||||
{
|
||||
$rtn = htmlspecialchars($this->data['commit_message']);
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitMessage($value)
|
||||
{
|
||||
$this->validateString('commit_message', $value);
|
||||
|
||||
if ($this->data['commit_message'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['commit_message'] = $value;
|
||||
|
||||
$this->setModified('commit_message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTag()
|
||||
{
|
||||
$rtn = $this->data['tag'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value string
|
||||
*/
|
||||
public function setTag($value)
|
||||
{
|
||||
$this->validateString('tag', $value);
|
||||
|
||||
if ($this->data['tag'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['tag'] = $value;
|
||||
|
||||
$this->setModified('tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
$rtn = $this->data['source'];
|
||||
|
||||
return (integer)$rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value integer
|
||||
*/
|
||||
public function setSource($value)
|
||||
{
|
||||
$this->validateInt('source', $value);
|
||||
|
||||
if ($this->data['source'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['source'] = $value;
|
||||
|
||||
$this->setModified('source');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
$rtn = $this->data['user_id'];
|
||||
|
||||
return (integer)$rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value integer
|
||||
*/
|
||||
public function setUserId($value)
|
||||
{
|
||||
$this->validateNotNull('user_id', $value);
|
||||
$this->validateInt('user_id', $value);
|
||||
|
||||
if ($this->data['user_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['user_id'] = $value;
|
||||
|
||||
$this->setModified('user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEnvironment()
|
||||
{
|
||||
$rtn = $this->data['environment'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value string
|
||||
*/
|
||||
public function setEnvironment($value)
|
||||
{
|
||||
$this->validateString('environment', $value);
|
||||
|
||||
if ($this->data['environment'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['environment'] = $value;
|
||||
|
||||
$this->setModified('environment');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of status only if it synced with db. Must not be null.
|
||||
*
|
||||
* @param $value int
|
||||
* @return bool
|
||||
*/
|
||||
public function setStatusSync($value)
|
||||
{
|
||||
$this->validateNotNull('Status', $value);
|
||||
$this->validateInt('Status', $value);
|
||||
$this->validateNotNull('status', $value);
|
||||
$this->validateInt('status', $value);
|
||||
|
||||
if ($this->data['status'] !== $value) {
|
||||
$store = Factory::getStore('Build');
|
||||
|
@ -347,185 +550,11 @@ class Build extends Model
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Log / log.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setLog($value)
|
||||
{
|
||||
$this->validateString('Log', $value);
|
||||
|
||||
if ($this->data['log'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['log'] = $value;
|
||||
|
||||
$this->setModified('log');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Branch / branch. Must not be null.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setBranch($value)
|
||||
{
|
||||
$this->validateNotNull('Branch', $value);
|
||||
$this->validateString('Branch', $value);
|
||||
|
||||
if ($this->data['branch'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['branch'] = $value;
|
||||
|
||||
$this->setModified('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Created / created.
|
||||
*
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setCreated($value)
|
||||
{
|
||||
$this->validateDate('Created', $value);
|
||||
|
||||
if ($this->data['created'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['created'] = $value;
|
||||
|
||||
$this->setModified('created');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Started / started.
|
||||
*
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setStarted($value)
|
||||
{
|
||||
$this->validateDate('Started', $value);
|
||||
|
||||
if ($this->data['started'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['started'] = $value;
|
||||
|
||||
$this->setModified('started');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Finished / finished.
|
||||
*
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setFinished($value)
|
||||
{
|
||||
$this->validateDate('Finished', $value);
|
||||
|
||||
if ($this->data['finished'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['finished'] = $value;
|
||||
|
||||
$this->setModified('finished');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of CommitterEmail / committer_email.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitterEmail($value)
|
||||
{
|
||||
$this->validateString('CommitterEmail', $value);
|
||||
|
||||
if ($this->data['committer_email'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['committer_email'] = $value;
|
||||
|
||||
$this->setModified('committer_email');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of CommitMessage / commit_message.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitMessage($value)
|
||||
{
|
||||
$this->validateString('CommitMessage', $value);
|
||||
|
||||
if ($this->data['commit_message'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['commit_message'] = $value;
|
||||
|
||||
$this->setModified('commit_message');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Extra / extra.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setExtra($value)
|
||||
{
|
||||
$this->validateString('Extra', $value);
|
||||
|
||||
if ($this->data['extra'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['extra'] = $value;
|
||||
|
||||
$this->setModified('extra');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Extra / extra.
|
||||
*
|
||||
* @param $name string
|
||||
* @param $value mixed
|
||||
*/
|
||||
public function setExtraValue($name, $value)
|
||||
{
|
||||
$extra = json_decode($this->data['extra'], true);
|
||||
if ($extra === false) {
|
||||
$extra = [];
|
||||
}
|
||||
$extra[$name] = $value;
|
||||
$this->setExtra(json_encode($extra));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the values of Extra / extra.
|
||||
*
|
||||
* @param $values mixed
|
||||
*/
|
||||
public function setExtraValues($values)
|
||||
{
|
||||
$extra = json_decode($this->data['extra'], true);
|
||||
if ($extra === false) {
|
||||
$extra = [];
|
||||
}
|
||||
$extra = array_replace($extra, $values);
|
||||
$this->setExtra(json_encode($extra));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a value from the build's "extra" JSON array.
|
||||
*
|
||||
* @param null $key
|
||||
*
|
||||
* @return mixed|null|string
|
||||
*/
|
||||
public function getExtra($key = null)
|
||||
|
@ -543,6 +572,53 @@ class Build extends Model
|
|||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value string
|
||||
*/
|
||||
public function setExtra($value)
|
||||
{
|
||||
$this->validateString('extra', $value);
|
||||
|
||||
if ($this->data['extra'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['extra'] = $value;
|
||||
|
||||
$this->setModified('extra');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of extra.
|
||||
*
|
||||
* @param $name string
|
||||
* @param $value mixed
|
||||
*/
|
||||
public function setExtraValue($name, $value)
|
||||
{
|
||||
$extra = json_decode($this->data['extra'], true);
|
||||
if ($extra === false) {
|
||||
$extra = [];
|
||||
}
|
||||
$extra[$name] = $value;
|
||||
$this->setExtra(json_encode($extra));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the values of extra.
|
||||
*
|
||||
* @param $values mixed
|
||||
*/
|
||||
public function setExtraValues($values)
|
||||
{
|
||||
$extra = json_decode($this->data['extra'], true);
|
||||
if ($extra === false) {
|
||||
$extra = [];
|
||||
}
|
||||
$extra = array_replace($extra, $values);
|
||||
$this->setExtra(json_encode($extra));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Project model for this Build by Id.
|
||||
*
|
||||
|
@ -764,17 +840,6 @@ class Build extends Model
|
|||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the commit message for this build.
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitMessage()
|
||||
{
|
||||
$rtn = htmlspecialchars($this->data['commit_message']);
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows specific build types (e.g. Github) to report violations back to their respective services.
|
||||
* @param Builder $builder
|
||||
|
@ -852,17 +917,18 @@ class Build extends Model
|
|||
|
||||
/**
|
||||
* Get the number of seconds a build has been running for.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDuration()
|
||||
{
|
||||
$start = $this->getStarted();
|
||||
$start = $this->getStartDate();
|
||||
|
||||
if (empty($start)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$end = $this->getFinished();
|
||||
$end = $this->getFinishDate();
|
||||
|
||||
if (empty($end)) {
|
||||
$end = new \DateTime();
|
||||
|
@ -873,15 +939,16 @@ class Build extends Model
|
|||
|
||||
/**
|
||||
* get time a build has been running for in hour/minute/seconds format (e.g. 1h 21m 45s)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrettyDuration()
|
||||
{
|
||||
$start = $this->getStarted();
|
||||
$start = $this->getStartDate();
|
||||
if (!$start) {
|
||||
$start = new \DateTime();
|
||||
}
|
||||
$end = $this->getFinished();
|
||||
$end = $this->getFinishDate();
|
||||
if (!$end) {
|
||||
$end = new \DateTime();
|
||||
}
|
||||
|
@ -910,96 +977,6 @@ class Build extends Model
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Tag / tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTag()
|
||||
{
|
||||
$rtn = $this->data['tag'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Tag / tag.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setTag($value)
|
||||
{
|
||||
$this->validateString('Tag', $value);
|
||||
|
||||
if ($this->data['tag'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['tag'] = $value;
|
||||
|
||||
$this->setModified('tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of source.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
$rtn = $this->data['source'];
|
||||
|
||||
return (integer)$rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of source.
|
||||
*
|
||||
* @param $value integer
|
||||
*/
|
||||
public function setSource($value)
|
||||
{
|
||||
$this->validateInt('Source', $value);
|
||||
|
||||
if ($this->data['source'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['source'] = $value;
|
||||
|
||||
$this->setModified('source');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Environment / environment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnvironment()
|
||||
{
|
||||
$rtn = $this->data['environment'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Environment / environment.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setEnvironment($value)
|
||||
{
|
||||
$this->validateString('Environment', $value);
|
||||
|
||||
if ($this->data['environment'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['environment'] = $value;
|
||||
|
||||
$this->setModified('environment');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an SSH key file on disk for this build.
|
||||
*
|
||||
|
|
|
@ -7,6 +7,11 @@ use b8\Store\Factory;
|
|||
|
||||
class BuildError extends Model
|
||||
{
|
||||
const SEVERITY_CRITICAL = 0;
|
||||
const SEVERITY_HIGH = 1;
|
||||
const SEVERITY_NORMAL = 2;
|
||||
const SEVERITY_LOW = 3;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
@ -76,8 +81,6 @@ class BuildError extends Model
|
|||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
|
@ -88,8 +91,6 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of BuildId / build_id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBuildId()
|
||||
|
@ -100,8 +101,6 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Plugin / plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPlugin()
|
||||
|
@ -112,8 +111,6 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of File / file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
|
@ -124,8 +121,6 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of LineStart / line_start.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLineStart()
|
||||
|
@ -136,8 +131,6 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of LineEnd / line_end.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLineEnd()
|
||||
|
@ -148,8 +141,6 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Severity / severity.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSeverity()
|
||||
|
@ -160,8 +151,6 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Message / message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage()
|
||||
|
@ -172,8 +161,6 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of CreatedDate / created_date.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getCreatedDate()
|
||||
|
@ -188,15 +175,12 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('Id', $value);
|
||||
$this->validateInt('Id', $value);
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
|
@ -208,15 +192,12 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of BuildId / build_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setBuildId($value)
|
||||
{
|
||||
$this->validateNotNull('BuildId', $value);
|
||||
$this->validateInt('BuildId', $value);
|
||||
$this->validateNotNull('build_id', $value);
|
||||
$this->validateInt('build_id', $value);
|
||||
|
||||
if ($this->data['build_id'] === $value) {
|
||||
return;
|
||||
|
@ -228,15 +209,12 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Plugin / plugin.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setPlugin($value)
|
||||
{
|
||||
$this->validateNotNull('Plugin', $value);
|
||||
$this->validateString('Plugin', $value);
|
||||
$this->validateNotNull('plugin', $value);
|
||||
$this->validateString('plugin', $value);
|
||||
|
||||
if ($this->data['plugin'] === $value) {
|
||||
return;
|
||||
|
@ -248,13 +226,11 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of File / file.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setFile($value)
|
||||
{
|
||||
$this->validateString('File', $value);
|
||||
$this->validateString('file', $value);
|
||||
|
||||
if ($this->data['file'] === $value) {
|
||||
return;
|
||||
|
@ -266,13 +242,11 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of LineStart / line_start.
|
||||
*
|
||||
* @param $value int
|
||||
*/
|
||||
public function setLineStart($value)
|
||||
{
|
||||
$this->validateInt('LineStart', $value);
|
||||
$this->validateInt('line_start', $value);
|
||||
|
||||
if ($this->data['line_start'] === $value) {
|
||||
return;
|
||||
|
@ -284,13 +258,11 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of LineEnd / line_end.
|
||||
*
|
||||
* @param $value int
|
||||
*/
|
||||
public function setLineEnd($value)
|
||||
{
|
||||
$this->validateInt('LineEnd', $value);
|
||||
$this->validateInt('line_end', $value);
|
||||
|
||||
if ($this->data['line_end'] === $value) {
|
||||
return;
|
||||
|
@ -302,15 +274,12 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Severity / severity.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setSeverity($value)
|
||||
{
|
||||
$this->validateNotNull('Severity', $value);
|
||||
$this->validateInt('Severity', $value);
|
||||
$this->validateNotNull('severity', $value);
|
||||
$this->validateInt('severity', $value);
|
||||
|
||||
if ($this->data['severity'] === $value) {
|
||||
return;
|
||||
|
@ -322,15 +291,12 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Message / message.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setMessage($value)
|
||||
{
|
||||
$this->validateNotNull('Message', $value);
|
||||
$this->validateString('Message', $value);
|
||||
$this->validateNotNull('message', $value);
|
||||
$this->validateString('message', $value);
|
||||
|
||||
if ($this->data['message'] === $value) {
|
||||
return;
|
||||
|
@ -342,15 +308,12 @@ class BuildError extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of CreatedDate / created_date.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setCreatedDate($value)
|
||||
{
|
||||
$this->validateNotNull('CreatedDate', $value);
|
||||
$this->validateDate('CreatedDate', $value);
|
||||
$this->validateNotNull('created_date', $value);
|
||||
$this->validateDate('created_date', $value);
|
||||
|
||||
if ($this->data['created_date'] === $value) {
|
||||
return;
|
||||
|
@ -364,8 +327,6 @@ class BuildError extends Model
|
|||
/**
|
||||
* Get the Build model for this BuildError by Id.
|
||||
*
|
||||
* @uses \PHPCensor\Store\BuildStore::getById()
|
||||
* @uses \PHPCensor\Model\Build
|
||||
* @return \PHPCensor\Model\Build
|
||||
*/
|
||||
public function getBuild()
|
||||
|
@ -418,13 +379,9 @@ class BuildError extends Model
|
|||
return $this->setBuildId($value->getId());
|
||||
}
|
||||
|
||||
const SEVERITY_CRITICAL = 0;
|
||||
const SEVERITY_HIGH = 1;
|
||||
const SEVERITY_NORMAL = 2;
|
||||
const SEVERITY_LOW = 3;
|
||||
|
||||
/**
|
||||
* Get the language string key for this error's severity level.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSeverityString()
|
||||
|
@ -446,6 +403,7 @@ class BuildError extends Model
|
|||
|
||||
/**
|
||||
* Get the class to apply to HTML elements representing this error.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSeverityClass()
|
||||
|
|
|
@ -61,8 +61,6 @@ class BuildMeta extends Model
|
|||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
|
@ -73,8 +71,6 @@ class BuildMeta extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of BuildId / build_id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBuildId()
|
||||
|
@ -85,8 +81,6 @@ class BuildMeta extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of MetaKey / meta_key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMetaKey()
|
||||
|
@ -97,8 +91,6 @@ class BuildMeta extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of MetaValue / meta_value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMetaValue()
|
||||
|
@ -109,15 +101,12 @@ class BuildMeta extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
* @param int $value
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('Id', $value);
|
||||
$this->validateInt('Id', $value);
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
|
@ -129,15 +118,12 @@ class BuildMeta extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of BuildId / build_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
* @param int $value
|
||||
*/
|
||||
public function setBuildId($value)
|
||||
{
|
||||
$this->validateNotNull('BuildId', $value);
|
||||
$this->validateInt('BuildId', $value);
|
||||
$this->validateNotNull('build_id', $value);
|
||||
$this->validateInt('build_id', $value);
|
||||
|
||||
if ($this->data['build_id'] === $value) {
|
||||
return;
|
||||
|
@ -149,15 +135,12 @@ class BuildMeta extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of MetaKey / meta_key.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setMetaKey($value)
|
||||
{
|
||||
$this->validateNotNull('MetaKey', $value);
|
||||
$this->validateString('MetaKey', $value);
|
||||
$this->validateNotNull('meta_key', $value);
|
||||
$this->validateString('meta_key', $value);
|
||||
|
||||
if ($this->data['meta_key'] === $value) {
|
||||
return;
|
||||
|
@ -169,15 +152,12 @@ class BuildMeta extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of MetaValue / meta_value.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setMetaValue($value)
|
||||
{
|
||||
$this->validateNotNull('MetaValue', $value);
|
||||
$this->validateString('MetaValue', $value);
|
||||
$this->validateNotNull('meta_value', $value);
|
||||
$this->validateString('meta_value', $value);
|
||||
|
||||
if ($this->data['meta_value'] === $value) {
|
||||
return;
|
||||
|
@ -191,8 +171,6 @@ class BuildMeta extends Model
|
|||
/**
|
||||
* Get the Build model for this BuildMeta by Id.
|
||||
*
|
||||
* @uses \PHPCensor\Store\BuildStore::getById()
|
||||
* @uses \PHPCensor\Model\Build
|
||||
* @return \PHPCensor\Model\Build
|
||||
*/
|
||||
public function getBuild()
|
||||
|
@ -203,8 +181,8 @@ class BuildMeta extends Model
|
|||
return null;
|
||||
}
|
||||
|
||||
$cacheKey = 'Cache.Build.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
$cacheKey = 'Cache.Build.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('Build', 'PHPCensor')->getById($key);
|
||||
|
|
|
@ -52,8 +52,6 @@ class Environment extends Model
|
|||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
|
@ -64,8 +62,6 @@ class Environment extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getProjectId()
|
||||
|
@ -76,8 +72,6 @@ class Environment extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Title / title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
|
@ -88,8 +82,6 @@ class Environment extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Title / title.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBranches()
|
||||
|
@ -100,15 +92,12 @@ class Environment extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('Id', $value);
|
||||
$this->validateInt('Id', $value);
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
|
@ -120,15 +109,12 @@ class Environment extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setProjectId($value)
|
||||
{
|
||||
$this->validateNotNull('ProjectId', $value);
|
||||
$this->validateInt('ProjectId', $value);
|
||||
$this->validateNotNull('project_id', $value);
|
||||
$this->validateInt('project_id', $value);
|
||||
|
||||
if ($this->data['project_id'] === $value) {
|
||||
return;
|
||||
|
@ -140,15 +126,12 @@ class Environment extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Name / name
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
$this->validateNotNull('Name', $value);
|
||||
$this->validateString('Name', $value);
|
||||
$this->validateNotNull('name', $value);
|
||||
$this->validateString('name', $value);
|
||||
|
||||
if ($this->data['name'] === $value) {
|
||||
return;
|
||||
|
@ -160,14 +143,11 @@ class Environment extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Branches / branches
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value array
|
||||
*/
|
||||
public function setBranches($value)
|
||||
{
|
||||
$this->validateNotNull('Branches', $value);
|
||||
$this->validateNotNull('branches', $value);
|
||||
$value = implode("\n", $value);
|
||||
|
||||
if ($this->data['branches'] === $value) {
|
||||
|
|
|
@ -98,8 +98,6 @@ class Project extends Model
|
|||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
|
@ -110,8 +108,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Title / title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
|
@ -122,8 +118,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Reference / reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReference()
|
||||
|
@ -134,8 +128,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of SshPrivateKey / ssh_private_key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSshPrivateKey()
|
||||
|
@ -146,8 +138,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Type / type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
|
@ -158,8 +148,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of LastCommit / last_commit.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastCommit()
|
||||
|
@ -170,8 +158,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of BuildConfig / build_config.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBuildConfig()
|
||||
|
@ -182,8 +168,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of SshPublicKey / ssh_public_key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSshPublicKey()
|
||||
|
@ -194,8 +178,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of AllowPublicStatus / allow_public_status.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAllowPublicStatus()
|
||||
|
@ -206,8 +188,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Archived / archived.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getArchived()
|
||||
|
@ -218,8 +198,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of GroupId / group_id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getGroupId()
|
||||
|
@ -230,8 +208,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of DefaultBranchOnly / default_branch_only.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDefaultBranchOnly()
|
||||
|
@ -242,15 +218,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('Id', $value);
|
||||
$this->validateInt('Id', $value);
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
|
@ -262,15 +235,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Title / title.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->validateNotNull('Title', $value);
|
||||
$this->validateString('Title', $value);
|
||||
$this->validateNotNull('title', $value);
|
||||
$this->validateString('title', $value);
|
||||
|
||||
if ($this->data['title'] === $value) {
|
||||
return;
|
||||
|
@ -282,15 +252,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Reference / reference.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setReference($value)
|
||||
{
|
||||
$this->validateNotNull('Reference', $value);
|
||||
$this->validateString('Reference', $value);
|
||||
$this->validateNotNull('reference', $value);
|
||||
$this->validateString('reference', $value);
|
||||
|
||||
if ($this->data['reference'] === $value) {
|
||||
return;
|
||||
|
@ -302,15 +269,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Branch / branch.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setBranch($value)
|
||||
{
|
||||
$this->validateNotNull('Branch', $value);
|
||||
$this->validateString('Branch', $value);
|
||||
$this->validateNotNull('branch', $value);
|
||||
$this->validateString('branch', $value);
|
||||
|
||||
if ($this->data['branch'] === $value) {
|
||||
return;
|
||||
|
@ -322,15 +286,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of DefaultBranchOnly / default_branch_only.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setDefaultBranchOnly($value)
|
||||
{
|
||||
$this->validateNotNull('DefaultBranchOnly', $value);
|
||||
$this->validateInt('DefaultBranchOnly', $value);
|
||||
$this->validateNotNull('default_branch_only', $value);
|
||||
$this->validateInt('default_branch_only', $value);
|
||||
|
||||
if ($this->data['default_branch_only'] === $value) {
|
||||
return;
|
||||
|
@ -342,13 +303,11 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of SshPrivateKey / ssh_private_key.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setSshPrivateKey($value)
|
||||
{
|
||||
$this->validateString('SshPrivateKey', $value);
|
||||
$this->validateString('ssh_private_key', $value);
|
||||
|
||||
if ($this->data['ssh_private_key'] === $value) {
|
||||
return;
|
||||
|
@ -360,15 +319,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Type / type.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
$this->validateNotNull('Type', $value);
|
||||
$this->validateString('Type', $value);
|
||||
$this->validateNotNull('type', $value);
|
||||
$this->validateString('type', $value);
|
||||
|
||||
if ($this->data['type'] === $value) {
|
||||
return;
|
||||
|
@ -380,13 +336,11 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of LastCommit / last_commit.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setLastCommit($value)
|
||||
{
|
||||
$this->validateString('LastCommit', $value);
|
||||
$this->validateString('last_commit', $value);
|
||||
|
||||
if ($this->data['last_commit'] === $value) {
|
||||
return;
|
||||
|
@ -398,13 +352,11 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of BuildConfig / build_config.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setBuildConfig($value)
|
||||
{
|
||||
$this->validateString('BuildConfig', $value);
|
||||
$this->validateString('build_config', $value);
|
||||
|
||||
if ($this->data['build_config'] === $value) {
|
||||
return;
|
||||
|
@ -416,13 +368,11 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of SshPublicKey / ssh_public_key.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setSshPublicKey($value)
|
||||
{
|
||||
$this->validateString('SshPublicKey', $value);
|
||||
$this->validateString('ssh_public_key', $value);
|
||||
|
||||
if ($this->data['ssh_public_key'] === $value) {
|
||||
return;
|
||||
|
@ -434,15 +384,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of AllowPublicStatus / allow_public_status.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setAllowPublicStatus($value)
|
||||
{
|
||||
$this->validateNotNull('AllowPublicStatus', $value);
|
||||
$this->validateInt('AllowPublicStatus', $value);
|
||||
$this->validateNotNull('allow_public_status', $value);
|
||||
$this->validateInt('allow_public_status', $value);
|
||||
|
||||
if ($this->data['allow_public_status'] === $value) {
|
||||
return;
|
||||
|
@ -454,15 +401,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Archived / archived.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setArchived($value)
|
||||
{
|
||||
$this->validateNotNull('Archived', $value);
|
||||
$this->validateInt('Archived', $value);
|
||||
$this->validateNotNull('archived', $value);
|
||||
$this->validateInt('archived', $value);
|
||||
|
||||
if ($this->data['archived'] === $value) {
|
||||
return;
|
||||
|
@ -474,15 +418,12 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of GroupId / group_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setGroupId($value)
|
||||
{
|
||||
$this->validateNotNull('GroupId', $value);
|
||||
$this->validateInt('GroupId', $value);
|
||||
$this->validateNotNull('group_id', $value);
|
||||
$this->validateInt('group_id', $value);
|
||||
|
||||
if ($this->data['group_id'] === $value) {
|
||||
return;
|
||||
|
@ -496,8 +437,6 @@ class Project extends Model
|
|||
/**
|
||||
* Get the ProjectGroup model for this Project by Id.
|
||||
*
|
||||
* @uses \PHPCensor\Store\ProjectGroupStore::getById()
|
||||
* @uses \PHPCensor\Model\ProjectGroup
|
||||
* @return \PHPCensor\Model\ProjectGroup
|
||||
*/
|
||||
public function getGroup()
|
||||
|
@ -508,11 +447,11 @@ class Project extends Model
|
|||
return null;
|
||||
}
|
||||
|
||||
$cacheKey = 'Cache.ProjectGroup.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
$cacheKey = 'Cache.ProjectGroup.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('ProjectGroup', 'PHPCensor')->getById($key);
|
||||
$rtn = Factory::getStore('ProjectGroup', 'PHPCensor')->getById($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
|
@ -553,8 +492,6 @@ class Project extends Model
|
|||
/**
|
||||
* Get Build models by ProjectId for this Project.
|
||||
*
|
||||
* @uses \PHPCensor\Store\BuildStore::getByProjectId()
|
||||
* @uses \PHPCensor\Model\Build
|
||||
* @return \PHPCensor\Model\Build[]
|
||||
*/
|
||||
public function getProjectBuilds()
|
||||
|
@ -564,8 +501,10 @@ class Project extends Model
|
|||
|
||||
/**
|
||||
* Return the latest build from a specific branch, of a specific status, for this project.
|
||||
*
|
||||
* @param string $branch
|
||||
* @param null $status
|
||||
* @param null $status
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getLatestBuild($branch = 'master', $status = null)
|
||||
|
@ -592,7 +531,9 @@ class Project extends Model
|
|||
|
||||
/**
|
||||
* Return the previous build from a specific branch, for this project.
|
||||
*
|
||||
* @param string $branch
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getPreviousBuild($branch = 'master')
|
||||
|
@ -613,7 +554,6 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Store this project's access_information data
|
||||
* @param string|array $value
|
||||
*/
|
||||
public function setAccessInformation($value)
|
||||
|
@ -622,7 +562,7 @@ class Project extends Model
|
|||
$value = json_encode($value);
|
||||
}
|
||||
|
||||
$this->validateString('AccessInformation', $value);
|
||||
$this->validateString('access_information', $value);
|
||||
|
||||
if ($this->data['access_information'] === $value) {
|
||||
return;
|
||||
|
@ -635,7 +575,9 @@ class Project extends Model
|
|||
|
||||
/**
|
||||
* Get this project's access_information data. Pass a specific key or null for all data.
|
||||
*
|
||||
* @param string|null $key
|
||||
*
|
||||
* @return mixed|null|string
|
||||
*/
|
||||
public function getAccessInformation($key = null)
|
||||
|
@ -661,7 +603,7 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Branch / branch.
|
||||
* Get the value of branch.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -688,6 +630,7 @@ class Project extends Model
|
|||
|
||||
/**
|
||||
* Return the name of a FontAwesome icon to represent this project, depending on its type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIcon()
|
||||
|
@ -740,7 +683,7 @@ class Project extends Model
|
|||
|
||||
if (empty($rtn)) {
|
||||
$store = $this->getEnvironmentStore();
|
||||
$rtn = $store->getByProjectId($key);
|
||||
$rtn = $store->getByProjectId($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,6 @@ class ProjectGroup extends Model
|
|||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
|
@ -59,8 +57,6 @@ class ProjectGroup extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Title / title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
|
@ -71,15 +67,12 @@ class ProjectGroup extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('Id', $value);
|
||||
$this->validateInt('Id', $value);
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
|
@ -91,15 +84,12 @@ class ProjectGroup extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Title / title.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->validateNotNull('Title', $value);
|
||||
$this->validateString('Title', $value);
|
||||
$this->validateNotNull('title', $value);
|
||||
$this->validateString('title', $value);
|
||||
|
||||
if ($this->data['title'] === $value) {
|
||||
return;
|
||||
|
@ -113,8 +103,6 @@ class ProjectGroup extends Model
|
|||
/**
|
||||
* Get Project models by GroupId for this ProjectGroup.
|
||||
*
|
||||
* @uses \PHPCensor\Store\ProjectStore::getByGroupId()
|
||||
* @uses \PHPCensor\Model\Project
|
||||
* @return \PHPCensor\Model\Project[]
|
||||
*/
|
||||
public function getGroupProjects()
|
||||
|
|
|
@ -74,8 +74,6 @@ class User extends Model
|
|||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
|
@ -86,8 +84,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Email / email.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
|
@ -98,8 +94,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Hash / hash.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHash()
|
||||
|
@ -110,8 +104,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Name / name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
|
@ -122,8 +114,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of IsAdmin / is_admin.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIsAdmin()
|
||||
|
@ -134,8 +124,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of ProviderKey / provider_key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderKey()
|
||||
|
@ -146,8 +134,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of ProviderData / provider_data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderData()
|
||||
|
@ -158,8 +144,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of RememberKey / remember_key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRememberKey()
|
||||
|
@ -170,8 +154,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of Language / language.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLanguage()
|
||||
|
@ -182,8 +164,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the value of PerPage / per_page.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPerPage()
|
||||
|
@ -194,15 +174,12 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->validateNotNull('Id', $value);
|
||||
$this->validateInt('Id', $value);
|
||||
$this->validateNotNull('id', $value);
|
||||
$this->validateInt('id', $value);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
|
@ -214,15 +191,12 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Email / email.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setEmail($value)
|
||||
{
|
||||
$this->validateNotNull('Email', $value);
|
||||
$this->validateString('Email', $value);
|
||||
$this->validateNotNull('email', $value);
|
||||
$this->validateString('email', $value);
|
||||
|
||||
if ($this->data['email'] === $value) {
|
||||
return;
|
||||
|
@ -234,15 +208,12 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Hash / hash.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setHash($value)
|
||||
{
|
||||
$this->validateNotNull('Hash', $value);
|
||||
$this->validateString('Hash', $value);
|
||||
$this->validateNotNull('hash', $value);
|
||||
$this->validateString('hash', $value);
|
||||
|
||||
if ($this->data['hash'] === $value) {
|
||||
return;
|
||||
|
@ -254,15 +225,12 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Name / name.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
$this->validateNotNull('Name', $value);
|
||||
$this->validateString('Name', $value);
|
||||
$this->validateNotNull('name', $value);
|
||||
$this->validateString('name', $value);
|
||||
|
||||
if ($this->data['name'] === $value) {
|
||||
return;
|
||||
|
@ -274,15 +242,12 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of IsAdmin / is_admin.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setIsAdmin($value)
|
||||
{
|
||||
$this->validateNotNull('IsAdmin', $value);
|
||||
$this->validateInt('IsAdmin', $value);
|
||||
$this->validateNotNull('is_admin', $value);
|
||||
$this->validateInt('is_admin', $value);
|
||||
|
||||
if ($this->data['is_admin'] === $value) {
|
||||
return;
|
||||
|
@ -294,15 +259,12 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of ProviderKey / provider_key.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setProviderKey($value)
|
||||
{
|
||||
$this->validateNotNull('ProviderKey', $value);
|
||||
$this->validateString('ProviderKey', $value);
|
||||
$this->validateNotNull('provider_key', $value);
|
||||
$this->validateString('provider_key', $value);
|
||||
|
||||
if ($this->data['provider_key'] === $value) {
|
||||
return;
|
||||
|
@ -314,13 +276,11 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of ProviderData / provider_data.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setProviderData($value)
|
||||
{
|
||||
$this->validateString('ProviderData', $value);
|
||||
$this->validateString('provider_data', $value);
|
||||
|
||||
if ($this->data['provider_data'] === $value) {
|
||||
return;
|
||||
|
@ -332,13 +292,11 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of RememberKey / remember_key.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setRememberKey($value)
|
||||
{
|
||||
$this->validateString('RememberKey', $value);
|
||||
$this->validateString('remember_key', $value);
|
||||
|
||||
if ($this->data['remember_key'] === $value) {
|
||||
return;
|
||||
|
@ -350,9 +308,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of Language / language.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setLanguage($value)
|
||||
|
@ -367,9 +322,6 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the value of PerPage / per_page.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setPerPage($value)
|
||||
|
|
|
@ -42,6 +42,7 @@ class BuildService
|
|||
* @param string|null $committerEmail
|
||||
* @param string|null $commitMessage
|
||||
* @param integer $source
|
||||
* @param integer $userId
|
||||
* @param string|null $extra
|
||||
*
|
||||
* @return \PHPCensor\Model\Build
|
||||
|
@ -55,10 +56,11 @@ class BuildService
|
|||
$committerEmail = null,
|
||||
$commitMessage = null,
|
||||
$source = Build::SOURCE_UNKNOWN,
|
||||
$userId = 0,
|
||||
$extra = null
|
||||
) {
|
||||
$build = new Build();
|
||||
$build->setCreated(new \DateTime());
|
||||
$build->setCreateDate(new \DateTime());
|
||||
$build->setProject($project);
|
||||
$build->setStatus(Build::STATUS_PENDING);
|
||||
$build->setEnvironment($environment);
|
||||
|
@ -67,6 +69,7 @@ class BuildService
|
|||
$build->setExtraValue('branches', $branches);
|
||||
|
||||
$build->setSource($source);
|
||||
$build->setUserId($userId);
|
||||
$build->setCommitId((string)$commitId);
|
||||
|
||||
if (!empty($branch)) {
|
||||
|
@ -121,7 +124,7 @@ class BuildService
|
|||
|
||||
$build = new Build();
|
||||
$build->setValues($data);
|
||||
$build->setCreated(new \DateTime());
|
||||
$build->setCreateDate(new \DateTime());
|
||||
$build->setStatus(Build::STATUS_PENDING);
|
||||
|
||||
/** @var Build $build */
|
||||
|
|
|
@ -155,7 +155,7 @@ class BuildStatusService
|
|||
{
|
||||
$dateFormat = 'Y-m-d\\TH:i:sO';
|
||||
if ($buildInfo = $this->getFinishedBuildInfo()) {
|
||||
return ($buildInfo->getFinished()) ? $buildInfo->getFinished()->format($dateFormat) : '';
|
||||
return ($buildInfo->getFinishDate()) ? $buildInfo->getFinishDate()->format($dateFormat) : '';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build $build
|
||||
*/
|
||||
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php print APP_URL; ?>build/view/<?php print $build->getId(); ?>">
|
||||
<?php if ($build->getCommitterEmail()): ?>
|
||||
|
@ -11,9 +20,9 @@
|
|||
<?php print $build->getProject()->getTitle(); ?>
|
||||
|
||||
<?php if ($build->getStatus() == \PHPCensor\Model\Build::STATUS_PENDING): ?>
|
||||
<small class="pull-right"><?php Lang::out('created_x', $build->getCreated()->format('H:i')); ?></small>
|
||||
<small class="pull-right"><?php Lang::out('created_x', $build->getCreateDate()->format('H:i')); ?></small>
|
||||
<?php elseif ($build->getStatus() == \PHPCensor\Model\Build::STATUS_RUNNING): ?>
|
||||
<small class="pull-right"><?php Lang::out('started_x', $build->getStarted()->format('H:i')); ?></small>
|
||||
<small class="pull-right"><?php Lang::out('started_x', $build->getStartDate()->format('H:i')); ?></small>
|
||||
<?php endif; ?>
|
||||
</h4>
|
||||
<p><?php Lang::out('branch_x', $build->getBranch()); ?></p>
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build $build
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
|
@ -124,28 +133,28 @@
|
|||
<tr>
|
||||
<th><?php Lang::out('created'); ?></th>
|
||||
<td style="text-align: right" class="build-created datetime">
|
||||
<?php print $build->getCreated() ? $build->getCreated()->format('Y-m-d H:i:s') : ''; ?>
|
||||
<?= ($build->getCreateDate() ? $build->getCreateDate()->format('Y-m-d H:i:s') : ''); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('started'); ?></th>
|
||||
<td style="text-align: right" class="build-started datetime">
|
||||
<?php print $build->getStarted() ? $build->getStarted()->format('Y-m-d H:i:s') : ''; ?>
|
||||
<?= ($build->getStartDate() ? $build->getStartDate()->format('Y-m-d H:i:s') : ''); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('finished'); ?></th>
|
||||
<td style="text-align: right" class="build-finished datetime">
|
||||
<?php print $build->getFinished() ? $build->getFinished()->format('Y-m-d H:i:s') : ''; ?>
|
||||
<?= ($build->getFinishDate() ? $build->getFinishDate()->format('Y-m-d H:i:s') : ''); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('duration'); ?></th>
|
||||
<td style="text-align: right" class="build-duration duration">
|
||||
<?php print $build->getDuration(); ?> <?= Lang::get('seconds'); ?>
|
||||
<?= $build->getDuration(); ?> <?= Lang::get('seconds'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
<td>
|
||||
<span class='label label-<?php echo $class ?>'><?php echo $status ?></span>
|
||||
</td>
|
||||
<td><?= $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
|
||||
<td><?= $build->getCreateDate()->format('Y-m-d H:i:s'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if (!empty($build->getCommitId())) {
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build[] $builds
|
||||
*/
|
||||
|
||||
$statuses = [];
|
||||
$failures = 0;
|
||||
|
@ -39,12 +45,12 @@ if (count($builds)) {
|
|||
break;
|
||||
case 2:
|
||||
$statuses[] = 'ok';
|
||||
$success = is_null($success) && !is_null($build->getFinished()) ? $build->getFinished()->format('Y-m-d H:i:s') : $success;
|
||||
$success = is_null($success) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $success;
|
||||
break;
|
||||
case 3:
|
||||
$failures++;
|
||||
$statuses[] = 'failed';
|
||||
$failure = is_null($failure) && !is_null($build->getFinished()) ? $build->getFinished()->format('Y-m-d H:i:s') : $failure;
|
||||
$failure = is_null($failure) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $failure;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -61,8 +67,8 @@ if ($buildCount > 0) {
|
|||
$shortMessage = Lang::get('x_of_x_failed_short', $failures, $buildCount);
|
||||
$message = Lang::get('x_of_x_failed', $failures, $buildCount);
|
||||
|
||||
if (!is_null($lastSuccess) && !is_null($lastSuccess->getFinished())) {
|
||||
$message .= Lang::get('last_successful_build', $lastSuccess->getFinished()->format('Y-m-d H:i:s'));
|
||||
if (!is_null($lastSuccess) && !is_null($lastSuccess->getFinishDate())) {
|
||||
$message .= Lang::get('last_successful_build', $lastSuccess->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_built_successfully');
|
||||
}
|
||||
|
@ -70,8 +76,8 @@ if ($buildCount > 0) {
|
|||
$message = Lang::get('all_builds_passed', $buildCount);
|
||||
$shortMessage = Lang::get('all_builds_passed_short', $buildCount, $buildCount);
|
||||
|
||||
if (!is_null($lastFailure) && !is_null($lastFailure->getFinished())) {
|
||||
$message .= Lang::get('last_failed_build', $lastFailure->getFinished()->format('Y-m-d H:i:s'));
|
||||
if (!is_null($lastFailure) && !is_null($lastFailure->getFinishDate())) {
|
||||
$message .= Lang::get('last_failed_build', $lastFailure->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_failed_build');
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build[] $builds
|
||||
*/
|
||||
|
||||
?>
|
||||
<ul class="timeline">
|
||||
<?php $last = new \DateTime('-1 Year'); ?>
|
||||
|
@ -14,32 +18,32 @@ use PHPCensor\Model\Build;
|
|||
|
||||
switch ($build->getStatus()) {
|
||||
case Build::STATUS_PENDING:
|
||||
$updated = $build->getCreated();
|
||||
$updated = $build->getCreateDate();
|
||||
$label = Lang::get('pending');
|
||||
$color = 'blue';
|
||||
break;
|
||||
|
||||
case Build::STATUS_RUNNING:
|
||||
$updated = $build->getStarted();
|
||||
$updated = $build->getStartDate();
|
||||
$label = Lang::get('running');
|
||||
$color = 'yellow';
|
||||
break;
|
||||
|
||||
case Build::STATUS_SUCCESS:
|
||||
$updated = $build->getFinished();
|
||||
$updated = $build->getFinishDate();
|
||||
$label = Lang::get('success');
|
||||
$color = 'green';
|
||||
break;
|
||||
|
||||
case Build::STATUS_FAILED:
|
||||
$updated = $build->getFinished();
|
||||
$updated = $build->getFinishDate();
|
||||
$label = Lang::get('failed');
|
||||
$color = 'red';
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$updated) {
|
||||
$updated = $build->getCreated();
|
||||
$updated = $build->getCreateDate();
|
||||
}
|
||||
|
||||
if ($updated->format('Y-m-d') != $last->format('Y-m-d')): $last = $updated;
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build[] $builds
|
||||
*/
|
||||
|
||||
foreach($projects as $project):
|
||||
$statuses = [];
|
||||
|
@ -40,12 +46,12 @@ foreach($projects as $project):
|
|||
break;
|
||||
case 2:
|
||||
$statuses[] = 'ok';
|
||||
$success = is_null($success) && !is_null($build->getFinished()) ? $build->getFinished()->format('Y-m-d H:i:s') : $success;
|
||||
$success = is_null($success) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $success;
|
||||
break;
|
||||
case 3:
|
||||
$failures++;
|
||||
$statuses[] = 'failed';
|
||||
$failure = is_null($failure) && !is_null($build->getFinished()) ? $build->getFinished()->format('Y-m-d H:i:s') : $failure;
|
||||
$failure = is_null($failure) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $failure;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -62,8 +68,8 @@ foreach($projects as $project):
|
|||
$shortMessage = Lang::get('x_of_x_failed_short', $failures, $buildCount);
|
||||
$message = Lang::get('x_of_x_failed', $failures, $buildCount);
|
||||
|
||||
if (!is_null($lastSuccess) && !is_null($lastSuccess->getFinished())) {
|
||||
$message .= Lang::get('last_successful_build', $lastSuccess->getFinished()->format('Y-m-d H:i:s'));
|
||||
if (!is_null($lastSuccess) && !is_null($lastSuccess->getFinishDate())) {
|
||||
$message .= Lang::get('last_successful_build', $lastSuccess->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_built_successfully');
|
||||
}
|
||||
|
@ -71,8 +77,8 @@ foreach($projects as $project):
|
|||
$message = Lang::get('all_builds_passed', $buildCount);
|
||||
$shortMessage = Lang::get('all_builds_passed_short', $buildCount, $buildCount);
|
||||
|
||||
if (!is_null($lastFailure) && !is_null($lastFailure->getFinished())) {
|
||||
$message .= Lang::get('last_failed_build', $lastFailure->getFinished()->format('Y-m-d H:i:s'));
|
||||
if (!is_null($lastFailure) && !is_null($lastFailure->getFinishDate())) {
|
||||
$message .= Lang::get('last_failed_build', $lastFailure->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_failed_build');
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build[] $builds
|
||||
*/
|
||||
|
||||
?>
|
||||
<script>
|
||||
var DASHBOARD = true;
|
||||
|
@ -45,32 +49,32 @@ use PHPCensor\Model\Build;
|
|||
|
||||
switch ($build->getStatus()) {
|
||||
case Build::STATUS_PENDING:
|
||||
$updated = $build->getCreated();
|
||||
$updated = $build->getCreateDate();
|
||||
$label = Lang::get('pending');
|
||||
$color = 'blue';
|
||||
break;
|
||||
|
||||
case Build::STATUS_RUNNING:
|
||||
$updated = $build->getStarted();
|
||||
$updated = $build->getStartDate();
|
||||
$label = Lang::get('running');
|
||||
$color = 'yellow';
|
||||
break;
|
||||
|
||||
case Build::STATUS_SUCCESS:
|
||||
$updated = $build->getFinished();
|
||||
$updated = $build->getFinishDate();
|
||||
$label = Lang::get('success');
|
||||
$color = 'green';
|
||||
break;
|
||||
|
||||
case Build::STATUS_FAILED:
|
||||
$updated = $build->getFinished();
|
||||
$updated = $build->getFinishDate();
|
||||
$label = Lang::get('failed');
|
||||
$color = 'red';
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$updated) {
|
||||
$updated = $build->getCreated();
|
||||
$updated = $build->getCreateDate();
|
||||
}
|
||||
|
||||
if ($updated->format('Y-m-d') != $last->format('Y-m-d')): $last = $updated;
|
||||
|
|
|
@ -42,7 +42,7 @@ $branches = $build->getExtra('branches');
|
|||
<tr>
|
||||
<td><a href="<?= APP_URL ?>build/view/<?= $build->getId(); ?>">#<?= str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
|
||||
<td><span class='label label-<?= $subcls ?>'><?= $status ?></span></td>
|
||||
<td><?= $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
|
||||
<td><?= $build->getCreateDate()->format('Y-m-d H:i:s'); ?></td>
|
||||
<td><?php Lang::out($build->getSourceHumanize()); ?></td>
|
||||
<td class="hidden-md hidden-sm hidden-xs">
|
||||
<?php
|
||||
|
|
|
@ -118,7 +118,7 @@ class BuildWorker
|
|||
$this->logger->addError($ex->getMessage());
|
||||
|
||||
$build->setStatus(Build::STATUS_FAILED);
|
||||
$build->setFinished(new \DateTime());
|
||||
$build->setFinishDate(new \DateTime());
|
||||
$build->setLog($build->getLog() . PHP_EOL . PHP_EOL . $ex->getMessage());
|
||||
$buildStore->save($build);
|
||||
$build->sendStatusPostback();
|
||||
|
|
|
@ -62,14 +62,14 @@ class BuildServiceTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$this->assertEquals(101, $returnValue->getProjectId());
|
||||
$this->assertEquals(Build::STATUS_PENDING, $returnValue->getStatus());
|
||||
$this->assertNull($returnValue->getStarted());
|
||||
$this->assertNull($returnValue->getFinished());
|
||||
$this->assertNull($returnValue->getStartDate());
|
||||
$this->assertNull($returnValue->getFinishDate());
|
||||
$this->assertNull($returnValue->getLog());
|
||||
$this->assertEquals(null, $returnValue->getCommitMessage());
|
||||
$this->assertNull($returnValue->getCommitterEmail());
|
||||
$this->assertEquals(['branches' => []], $returnValue->getExtra());
|
||||
$this->assertEquals('master', $returnValue->getBranch());
|
||||
$this->assertInstanceOf('DateTime', $returnValue->getCreated());
|
||||
$this->assertInstanceOf('DateTime', $returnValue->getCreateDate());
|
||||
$this->assertEquals('', $returnValue->getCommitId());
|
||||
$this->assertEquals(Build::SOURCE_UNKNOWN, $returnValue->getSource());
|
||||
}
|
||||
|
@ -142,8 +142,8 @@ class BuildServiceTest extends \PHPUnit\Framework\TestCase
|
|||
$build->setStatus(Build::STATUS_FAILED);
|
||||
$build->setLog('Test');
|
||||
$build->setBranch('example_branch');
|
||||
$build->setStarted(new \DateTime());
|
||||
$build->setFinished(new \DateTime());
|
||||
$build->setStartDate(new \DateTime());
|
||||
$build->setFinishDate(new \DateTime());
|
||||
$build->setCommitMessage('test');
|
||||
$build->setCommitterEmail('test@example.com');
|
||||
$build->setExtra(json_encode(['item1' => 1001]));
|
||||
|
@ -157,9 +157,9 @@ class BuildServiceTest extends \PHPUnit\Framework\TestCase
|
|||
$this->assertEquals(Build::STATUS_PENDING, $returnValue->getStatus());
|
||||
$this->assertNull($returnValue->getLog());
|
||||
$this->assertEquals($build->getBranch(), $returnValue->getBranch());
|
||||
$this->assertNotEquals($build->getCreated(), $returnValue->getCreated());
|
||||
$this->assertNull($returnValue->getStarted());
|
||||
$this->assertNull($returnValue->getFinished());
|
||||
$this->assertNotEquals($build->getCreateDate(), $returnValue->getCreateDate());
|
||||
$this->assertNull($returnValue->getStartDate());
|
||||
$this->assertNull($returnValue->getFinishDate());
|
||||
$this->assertEquals('test', $returnValue->getCommitMessage());
|
||||
$this->assertEquals('test@example.com', $returnValue->getCommitterEmail());
|
||||
$this->assertEquals($build->getExtra('item1'), $returnValue->getExtra('item1'));
|
||||
|
|
|
@ -86,10 +86,10 @@ class BuildStatusServiceTest extends \PHPUnit\Framework\TestCase
|
|||
$build->setBranch(self::BRANCH);
|
||||
$build->setStatus($config[$configId]['status']);
|
||||
if ($config[$configId]['finishDateTime']) {
|
||||
$build->setFinished(new \DateTime($config[$configId]['finishDateTime']));
|
||||
$build->setFinishDate(new \DateTime($config[$configId]['finishDateTime']));
|
||||
}
|
||||
if (!empty($config[$configId]['startedDate'])) {
|
||||
$build->setStarted(new \DateTime('2014-10-25 21:20:02'));
|
||||
$build->setStartDate(new \DateTime('2014-10-25 21:20:02'));
|
||||
}
|
||||
|
||||
$project = $this->getProjectMock($config[$configId]['previousBuild'], $setProject);
|
||||
|
|
Loading…
Reference in a new issue