Build sources instead of 'Manual' word.
This commit is contained in:
parent
ca0f7b4182
commit
145670acde
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PHPCensor\Command;
|
namespace PHPCensor\Command;
|
||||||
|
|
||||||
|
use PHPCensor\Model\Build;
|
||||||
use PHPCensor\Service\BuildService;
|
use PHPCensor\Service\BuildService;
|
||||||
use PHPCensor\Store\ProjectStore;
|
use PHPCensor\Store\ProjectStore;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
@ -72,7 +73,7 @@ class CreateBuildCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->buildService->createBuild($project, $environment, $commitId, $branch, null, $ciEmail, $ciMessage);
|
$this->buildService->createBuild($project, $environment, $commitId, $branch, null, $ciEmail, $ciMessage, Build::SOURCE_MANUAL_CONSOLE);
|
||||||
$output->writeln('Build Created');
|
$output->writeln('Build Created');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$output->writeln('<error>Failed</error>');
|
$output->writeln('<error>Failed</error>');
|
||||||
|
|
|
@ -90,7 +90,7 @@ class ScheduleBuildCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->buildService->createBuild($project, null);
|
$this->buildService->createBuild($project, null, '', null, null, null, null, Build::SOURCE_PERIODICAL);
|
||||||
$output->writeln("Build Created for {$project->getTitle()}");
|
$output->writeln("Build Created for {$project->getTitle()}");
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$output->writeln('<error>Failed</error>');
|
$output->writeln('<error>Failed</error>');
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace PHPCensor\Controller;
|
namespace PHPCensor\Controller;
|
||||||
|
|
||||||
use b8;
|
use b8;
|
||||||
use b8\Form;
|
|
||||||
use b8\Exception\HttpException\NotFoundException;
|
use b8\Exception\HttpException\NotFoundException;
|
||||||
|
use b8\Form;
|
||||||
use b8\Store;
|
use b8\Store;
|
||||||
use PHPCensor;
|
use PHPCensor;
|
||||||
use PHPCensor\BuildFactory;
|
use PHPCensor\BuildFactory;
|
||||||
|
@ -13,6 +13,8 @@ use PHPCensor\Helper\Lang;
|
||||||
use PHPCensor\Helper\SshKey;
|
use PHPCensor\Helper\SshKey;
|
||||||
use PHPCensor\Service\BuildService;
|
use PHPCensor\Service\BuildService;
|
||||||
use PHPCensor\Service\ProjectService;
|
use PHPCensor\Service\ProjectService;
|
||||||
|
use PHPCensor\Model\Build;
|
||||||
|
use b8\Http\Response\RedirectResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project Controller - Allows users to create, edit and view projects.
|
* Project Controller - Allows users to create, edit and view projects.
|
||||||
|
@ -96,7 +98,7 @@ class ProjectController extends PHPCensor\Controller
|
||||||
$pages = $builds[1] == 0 ? 1 : ceil($builds[1] / $perPage);
|
$pages = $builds[1] == 0 ? 1 : ceil($builds[1] / $perPage);
|
||||||
|
|
||||||
if ($page > $pages) {
|
if ($page > $pages) {
|
||||||
$response = new b8\Http\Response\RedirectResponse();
|
$response = new RedirectResponse();
|
||||||
$response->setHeader('Location', APP_URL . 'project/view/' . $projectId);
|
$response->setHeader('Location', APP_URL . 'project/view/' . $projectId);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -132,7 +134,7 @@ class ProjectController extends PHPCensor\Controller
|
||||||
*
|
*
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
*
|
*
|
||||||
* @return b8\Http\Response\RedirectResponse
|
* @return RedirectResponse
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function build($projectId)
|
public function build($projectId)
|
||||||
|
@ -175,11 +177,12 @@ class ProjectController extends PHPCensor\Controller
|
||||||
$build = $this->buildService->createBuild(
|
$build = $this->buildService->createBuild(
|
||||||
$project,
|
$project,
|
||||||
$environment,
|
$environment,
|
||||||
null,
|
'',
|
||||||
$branch,
|
$branch,
|
||||||
null,
|
null,
|
||||||
$email,
|
$email,
|
||||||
null,
|
null,
|
||||||
|
Build::SOURCE_MANUAL_WEB,
|
||||||
$extra
|
$extra
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -187,7 +190,7 @@ class ProjectController extends PHPCensor\Controller
|
||||||
$_SESSION['global_error'] = Lang::get('add_to_queue_failed');
|
$_SESSION['global_error'] = Lang::get('add_to_queue_failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new b8\Http\Response\RedirectResponse();
|
$response = new RedirectResponse();
|
||||||
$response->setHeader('Location', APP_URL.'build/view/' . $build->getId());
|
$response->setHeader('Location', APP_URL.'build/view/' . $build->getId());
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -203,7 +206,7 @@ class ProjectController extends PHPCensor\Controller
|
||||||
$project = $this->projectStore->getById($projectId);
|
$project = $this->projectStore->getById($projectId);
|
||||||
$this->projectService->deleteProject($project);
|
$this->projectService->deleteProject($project);
|
||||||
|
|
||||||
$response = new b8\Http\Response\RedirectResponse();
|
$response = new RedirectResponse();
|
||||||
$response->setHeader('Location', APP_URL);
|
$response->setHeader('Location', APP_URL);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -324,7 +327,7 @@ class ProjectController extends PHPCensor\Controller
|
||||||
|
|
||||||
$project = $this->projectService->createProject($title, $type, $reference, $options);
|
$project = $this->projectService->createProject($title, $type, $reference, $options);
|
||||||
|
|
||||||
$response = new b8\Http\Response\RedirectResponse();
|
$response = new RedirectResponse();
|
||||||
$response->setHeader('Location', APP_URL.'project/view/' . $project->getId());
|
$response->setHeader('Location', APP_URL.'project/view/' . $project->getId());
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -393,7 +396,7 @@ class ProjectController extends PHPCensor\Controller
|
||||||
|
|
||||||
$project = $this->projectService->updateProject($project, $title, $type, $reference, $options);
|
$project = $this->projectService->updateProject($project, $title, $type, $reference, $options);
|
||||||
|
|
||||||
$response = new b8\Http\Response\RedirectResponse();
|
$response = new RedirectResponse();
|
||||||
$response->setHeader('Location', APP_URL.'project/view/' . $project->getId());
|
$response->setHeader('Location', APP_URL.'project/view/' . $project->getId());
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
@ -665,6 +665,7 @@ class WebhookController extends Controller
|
||||||
$tag,
|
$tag,
|
||||||
$committer,
|
$committer,
|
||||||
$commitMessage,
|
$commitMessage,
|
||||||
|
Build::SOURCE_WEBHOOK,
|
||||||
$extra
|
$extra
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -702,6 +703,7 @@ class WebhookController extends Controller
|
||||||
$tag,
|
$tag,
|
||||||
$committer,
|
$committer,
|
||||||
$commitMessage,
|
$commitMessage,
|
||||||
|
Build::SOURCE_WEBHOOK,
|
||||||
$extra
|
$extra
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,13 @@ PHP Censor',
|
||||||
'next_link' => 'Next »',
|
'next_link' => 'Next »',
|
||||||
'public_key' => 'Public Key',
|
'public_key' => 'Public Key',
|
||||||
'delete_build' => 'Delete Build',
|
'delete_build' => 'Delete Build',
|
||||||
|
'build_source' => 'Build source',
|
||||||
|
|
||||||
|
'source_unknown' => 'Unknown',
|
||||||
|
'source_manual_web' => 'Manual (from Web)',
|
||||||
|
'source_manual_console' => 'Manual (from CLI)',
|
||||||
|
'source_periodical' => 'Periodical',
|
||||||
|
'source_webhook' => 'Webhook',
|
||||||
|
|
||||||
'webhooks' => 'Webhooks',
|
'webhooks' => 'Webhooks',
|
||||||
'webhooks_help_github' => 'To automatically build this project when new commits are pushed, add the URL below
|
'webhooks_help_github' => 'To automatically build this project when new commits are pushed, add the URL below
|
||||||
|
|
|
@ -142,6 +142,13 @@ PHP Censor',
|
||||||
'next_link' => 'След. »',
|
'next_link' => 'След. »',
|
||||||
'public_key' => 'Публичный ключ',
|
'public_key' => 'Публичный ключ',
|
||||||
'delete_build' => 'Удалить сборку',
|
'delete_build' => 'Удалить сборку',
|
||||||
|
'build_source' => 'Источник сборки',
|
||||||
|
|
||||||
|
'source_unknown' => 'Неизвестный',
|
||||||
|
'source_manual_web' => 'Вручную (Через Web)',
|
||||||
|
'source_manual_console' => 'Вручную (Через CLI)',
|
||||||
|
'source_periodical' => 'Переодический',
|
||||||
|
'source_webhook' => 'Webhook',
|
||||||
|
|
||||||
'webhooks' => 'Webhooks',
|
'webhooks' => 'Webhooks',
|
||||||
'webhooks_help_github' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже в качестве нового хука в разделе настроек <a href="https://github.com/%s/settings/hooks">Webhooks
|
'webhooks_help_github' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже в качестве нового хука в разделе настроек <a href="https://github.com/%s/settings/hooks">Webhooks
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
use Phinx\Migration\AbstractMigration;
|
use Phinx\Migration\AbstractMigration;
|
||||||
use PHPCensor\Model\BuildMeta;
|
use PHPCensor\Model\BuildMeta;
|
||||||
use PHPCensor\Model\BuildError;
|
use PHPCensor\Model\BuildError;
|
||||||
|
use b8\Store\Factory;
|
||||||
|
|
||||||
class ConvertErrors extends AbstractMigration
|
class ConvertErrors extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
@ -20,10 +21,10 @@ class ConvertErrors extends AbstractMigration
|
||||||
{
|
{
|
||||||
$count = 100;
|
$count = 100;
|
||||||
|
|
||||||
$this->metaStore = \b8\Store\Factory::getStore('BuildMeta');
|
$this->metaStore = Factory::getStore('BuildMeta');
|
||||||
$this->errorStore = \b8\Store\Factory::getStore('BuildError');
|
$this->errorStore = Factory::getStore('BuildError');
|
||||||
|
|
||||||
while ($count == 100) {
|
while ($count === 100) {
|
||||||
$data = $this->metaStore->getErrorsForUpgrade(100);
|
$data = $this->metaStore->getErrorsForUpgrade(100);
|
||||||
$count = count($data);
|
$count = count($data);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
use PHPCensor\Model\Build;
|
||||||
|
|
||||||
|
class AddedSourceColumnToBuildTable extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$table = $this->table('build');
|
||||||
|
|
||||||
|
if (!$table->hasColumn('source')) {
|
||||||
|
$table
|
||||||
|
->addColumn('source', 'integer', ['default' => Build::SOURCE_UNKNOWN])
|
||||||
|
->save();
|
||||||
|
|
||||||
|
$this->execute("UPDATE build SET source = 4");
|
||||||
|
$this->execute("UPDATE build SET source = 1, commit_id = '', commit_message = '' WHERE commit_id = 'Manual'");
|
||||||
|
$this->execute("UPDATE build SET source = 1, commit_message = '' WHERE commit_message = 'Manual'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$table = $this->table('build');
|
||||||
|
|
||||||
|
if ($table->hasColumn('source')) {
|
||||||
|
$table
|
||||||
|
->removeColumn('source')
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,6 +25,12 @@ class Build extends Model
|
||||||
const STATUS_RUNNING = 1;
|
const STATUS_RUNNING = 1;
|
||||||
const STATUS_SUCCESS = 2;
|
const STATUS_SUCCESS = 2;
|
||||||
const STATUS_FAILED = 3;
|
const STATUS_FAILED = 3;
|
||||||
|
|
||||||
|
const SOURCE_UNKNOWN = 0;
|
||||||
|
const SOURCE_MANUAL_WEB = 1;
|
||||||
|
const SOURCE_MANUAL_CONSOLE = 2;
|
||||||
|
const SOURCE_PERIODICAL = 3;
|
||||||
|
const SOURCE_WEBHOOK = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -59,6 +65,7 @@ class Build extends Model
|
||||||
'commit_message' => null,
|
'commit_message' => null,
|
||||||
'extra' => null,
|
'extra' => null,
|
||||||
'environment' => null,
|
'environment' => null,
|
||||||
|
'source' => Build::SOURCE_UNKNOWN,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,6 +87,7 @@ class Build extends Model
|
||||||
'commit_message' => 'getCommitMessage',
|
'commit_message' => 'getCommitMessage',
|
||||||
'extra' => 'getExtra',
|
'extra' => 'getExtra',
|
||||||
'environment' => 'getEnvironment',
|
'environment' => 'getEnvironment',
|
||||||
|
'source' => 'getSource',
|
||||||
|
|
||||||
// Foreign key getters:
|
// Foreign key getters:
|
||||||
'Project' => 'getProject',
|
'Project' => 'getProject',
|
||||||
|
@ -104,6 +112,7 @@ class Build extends Model
|
||||||
'commit_message' => 'setCommitMessage',
|
'commit_message' => 'setCommitMessage',
|
||||||
'extra' => 'setExtra',
|
'extra' => 'setExtra',
|
||||||
'environment' => 'setEnvironment',
|
'environment' => 'setEnvironment',
|
||||||
|
'source' => 'setSource',
|
||||||
|
|
||||||
// Foreign key setters:
|
// Foreign key setters:
|
||||||
'Project' => 'setProject',
|
'Project' => 'setProject',
|
||||||
|
@ -182,10 +191,15 @@ class Build extends Model
|
||||||
'default' => null,
|
'default' => null,
|
||||||
],
|
],
|
||||||
'environment' => [
|
'environment' => [
|
||||||
'type' => 'varchar',
|
'type' => 'varchar',
|
||||||
'length' => 250,
|
'length' => 250,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
],
|
],
|
||||||
|
'source' => [
|
||||||
|
'type' => 'int',
|
||||||
|
'length' => 11,
|
||||||
|
'default' => Build::SOURCE_UNKNOWN,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,25 +227,25 @@ class Build extends Model
|
||||||
/**
|
/**
|
||||||
* Get the value of Id / id.
|
* Get the value of Id / id.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getId()
|
public function getId()
|
||||||
{
|
{
|
||||||
$rtn = $this->data['id'];
|
$rtn = $this->data['id'];
|
||||||
|
|
||||||
return $rtn;
|
return (integer)$rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of ProjectId / project_id.
|
* Get the value of ProjectId / project_id.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getProjectId()
|
public function getProjectId()
|
||||||
{
|
{
|
||||||
$rtn = $this->data['project_id'];
|
$rtn = $this->data['project_id'];
|
||||||
|
|
||||||
return $rtn;
|
return (integer)$rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,13 +263,13 @@ class Build extends Model
|
||||||
/**
|
/**
|
||||||
* Get the value of Status / status.
|
* Get the value of Status / status.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getStatus()
|
public function getStatus()
|
||||||
{
|
{
|
||||||
$rtn = $this->data['status'];
|
$rtn = $this->data['status'];
|
||||||
|
|
||||||
return $rtn;
|
return (integer)$rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1032,6 +1046,36 @@ class Build extends Model
|
||||||
$this->setModified('tag');
|
$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.
|
* Get the value of Environment / environment.
|
||||||
*
|
*
|
||||||
|
@ -1107,4 +1151,24 @@ OUT;
|
||||||
|
|
||||||
return $wrapperFile;
|
return $wrapperFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSourceHumanize()
|
||||||
|
{
|
||||||
|
switch ($this->getSource()) {
|
||||||
|
case Build::SOURCE_WEBHOOK:
|
||||||
|
return 'source_webhook';
|
||||||
|
case Build::SOURCE_MANUAL_WEB:
|
||||||
|
return 'source_manual_web';
|
||||||
|
case Build::SOURCE_MANUAL_CONSOLE:
|
||||||
|
return 'source_manual_console';
|
||||||
|
case Build::SOURCE_PERIODICAL:
|
||||||
|
return 'source_periodical';
|
||||||
|
case Build::SOURCE_UNKNOWN:
|
||||||
|
default:
|
||||||
|
return 'source_unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use PHPCensor\Builder;
|
||||||
use PHPCensor\Helper\Bitbucket;
|
use PHPCensor\Helper\Bitbucket;
|
||||||
use PHPCensor\Helper\Diff;
|
use PHPCensor\Helper\Diff;
|
||||||
use b8\Config;
|
use b8\Config;
|
||||||
|
use PHPCensor\Model\Build;
|
||||||
use PHPCensor\Model\BuildError;
|
use PHPCensor\Model\BuildError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,17 +48,16 @@ class BitbucketBuild extends RemoteGitBuild
|
||||||
*/
|
*/
|
||||||
public function sendStatusPostback()
|
public function sendStatusPostback()
|
||||||
{
|
{
|
||||||
if ('Manual' === $this->getCommitId()) {
|
if (Build::SOURCE_WEBHOOK !== $this->getSource()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$project = $this->getProject();
|
$project = $this->getProject();
|
||||||
|
|
||||||
if (empty($project)) {
|
if (empty($project)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$username = Config::getInstance()->get('php-censor.bitbucket.username');
|
$username = Config::getInstance()->get('php-censor.bitbucket.username');
|
||||||
$appPassword = Config::getInstance()->get('php-censor.bitbucket.app_password');
|
$appPassword = Config::getInstance()->get('php-censor.bitbucket.app_password');
|
||||||
|
|
||||||
if (empty($username) || empty($appPassword) || empty($this->data['id'])) {
|
if (empty($username) || empty($appPassword) || empty($this->data['id'])) {
|
||||||
|
@ -261,18 +261,18 @@ class BitbucketBuild extends RemoteGitBuild
|
||||||
*/
|
*/
|
||||||
protected function getDiffLineNumber(Builder $builder, $file, $line)
|
protected function getDiffLineNumber(Builder $builder, $file, $line)
|
||||||
{
|
{
|
||||||
$line = (integer)$line;
|
|
||||||
|
|
||||||
$builder->logExecOutput(false);
|
$builder->logExecOutput(false);
|
||||||
|
|
||||||
|
$line = (integer)$line;
|
||||||
$prNumber = $this->getExtra('pull_request_number');
|
$prNumber = $this->getExtra('pull_request_number');
|
||||||
$path = $builder->buildPath;
|
$path = $builder->buildPath;
|
||||||
|
|
||||||
if (!empty($prNumber)) {
|
if (!empty($prNumber)) {
|
||||||
$builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file);
|
$builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file);
|
||||||
} else {
|
} else {
|
||||||
$commitId = $this->getCommitId();
|
$commitId = $this->getCommitId();
|
||||||
$compare = $commitId == 'Manual' ? 'HEAD' : $commitId;
|
$compare = empty($commitId) ? 'HEAD' : $commitId;
|
||||||
|
|
||||||
$builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file);
|
$builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ class BitbucketBuild extends RemoteGitBuild
|
||||||
$diff = $builder->getLastOutput();
|
$diff = $builder->getLastOutput();
|
||||||
|
|
||||||
$helper = new Diff();
|
$helper = new Diff();
|
||||||
$lines = $helper->getLinePositions($diff);
|
$lines = $helper->getLinePositions($diff);
|
||||||
|
|
||||||
return isset($lines[$line]) ? $lines[$line] : null;
|
return isset($lines[$line]) ? $lines[$line] : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use PHPCensor\Builder;
|
||||||
use PHPCensor\Helper\Diff;
|
use PHPCensor\Helper\Diff;
|
||||||
use PHPCensor\Helper\Github;
|
use PHPCensor\Helper\Github;
|
||||||
use b8\Config;
|
use b8\Config;
|
||||||
|
use PHPCensor\Model\Build;
|
||||||
use PHPCensor\Model\BuildError;
|
use PHPCensor\Model\BuildError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +46,7 @@ class GithubBuild extends RemoteGitBuild
|
||||||
*/
|
*/
|
||||||
public function sendStatusPostback()
|
public function sendStatusPostback()
|
||||||
{
|
{
|
||||||
if ('Manual' === $this->getCommitId()) {
|
if (Build::SOURCE_WEBHOOK !== $this->getSource()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,18 +247,18 @@ class GithubBuild extends RemoteGitBuild
|
||||||
*/
|
*/
|
||||||
protected function getDiffLineNumber(Builder $builder, $file, $line)
|
protected function getDiffLineNumber(Builder $builder, $file, $line)
|
||||||
{
|
{
|
||||||
$line = (integer)$line;
|
|
||||||
|
|
||||||
$builder->logExecOutput(false);
|
$builder->logExecOutput(false);
|
||||||
|
|
||||||
|
$line = (integer)$line;
|
||||||
$prNumber = $this->getExtra('pull_request_number');
|
$prNumber = $this->getExtra('pull_request_number');
|
||||||
$path = $builder->buildPath;
|
$path = $builder->buildPath;
|
||||||
|
|
||||||
if (!empty($prNumber)) {
|
if (!empty($prNumber)) {
|
||||||
$builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file);
|
$builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file);
|
||||||
} else {
|
} else {
|
||||||
$commitId = $this->getCommitId();
|
$commitId = $this->getCommitId();
|
||||||
$compare = $commitId == 'Manual' ? 'HEAD' : $commitId;
|
$compare = empty($commitId) ? 'HEAD' : $commitId;
|
||||||
|
|
||||||
$builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file);
|
$builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +267,7 @@ class GithubBuild extends RemoteGitBuild
|
||||||
$diff = $builder->getLastOutput();
|
$diff = $builder->getLastOutput();
|
||||||
|
|
||||||
$helper = new Diff();
|
$helper = new Diff();
|
||||||
$lines = $helper->getLinePositions($diff);
|
$lines = $helper->getLinePositions($diff);
|
||||||
|
|
||||||
return isset($lines[$line]) ? $lines[$line] : null;
|
return isset($lines[$line]) ? $lines[$line] : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,7 @@ class GogsBuild extends RemoteGitBuild
|
||||||
*/
|
*/
|
||||||
public function getCommitLink()
|
public function getCommitLink()
|
||||||
{
|
{
|
||||||
if ($this->getCommitId() !== 'manual'){
|
return $this->getProject()->getReference() . '/commit/' . $this->getCommitId();
|
||||||
return $this->getProject()->getReference() . '/commit/' . $this->getCommitId();
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::getCommitLink();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,6 +35,7 @@ class MercurialBuild extends Build
|
||||||
|
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
$builder->logFailure('Failed to clone remote hg repository.');
|
$builder->logFailure('Failed to clone remote hg repository.');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +85,12 @@ class MercurialBuild extends Build
|
||||||
*/
|
*/
|
||||||
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)
|
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)
|
||||||
{
|
{
|
||||||
$success = true;
|
$success = true;
|
||||||
$commit = $this->getCommitId();
|
$commitId = $this->getCommitId();
|
||||||
|
|
||||||
// Allow switching to a specific branch:
|
// Allow switching to a specific branch:
|
||||||
if (!empty($commit) && $commit != 'Manual') {
|
if (!empty($commitId)) {
|
||||||
$cmd = 'cd "%s" && hg checkout %s';
|
$cmd = 'cd "%s" && hg checkout %s';
|
||||||
$success = $builder->executeCommand($cmd, $cloneTo, $this->getBranch());
|
$success = $builder->executeCommand($cmd, $cloneTo, $this->getBranch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,18 +137,24 @@ class RemoteGitBuild extends Build
|
||||||
*/
|
*/
|
||||||
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)
|
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)
|
||||||
{
|
{
|
||||||
$success = true;
|
$success = true;
|
||||||
$commit = $this->getCommitId();
|
$commitId = $this->getCommitId();
|
||||||
$chdir = 'cd "%s"';
|
$chdir = 'cd "%s"';
|
||||||
|
|
||||||
if (empty($this->getEnvironment()) && !empty($commit) && $commit != 'Manual') {
|
if (empty($this->getEnvironment()) && !empty($commitId)) {
|
||||||
$cmd = $chdir . ' && git checkout %s --quiet';
|
$cmd = $chdir . ' && git checkout %s --quiet';
|
||||||
$success = $builder->executeCommand($cmd, $cloneTo, $commit);
|
$success = $builder->executeCommand($cmd, $cloneTo, $commitId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always update the commit hash with the actual HEAD hash
|
// Always update the commit hash with the actual HEAD hash
|
||||||
if ($builder->executeCommand($chdir . ' && git rev-parse HEAD', $cloneTo)) {
|
if ($builder->executeCommand($chdir . ' && git rev-parse HEAD', $cloneTo)) {
|
||||||
$this->setCommitId(trim($builder->getLastOutput()));
|
$commitId = trim($builder->getLastOutput());
|
||||||
|
|
||||||
|
$this->setCommitId($commitId);
|
||||||
|
|
||||||
|
if ($builder->executeCommand($chdir . ' && git log -1 --pretty=format:%%s %s', $cloneTo, $commitId)) {
|
||||||
|
$this->setCommitMessage(trim($builder->getLastOutput()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
|
|
|
@ -95,7 +95,7 @@ class SubversionBuild extends Build
|
||||||
{
|
{
|
||||||
$cmd = $this->svnCommand;
|
$cmd = $this->svnCommand;
|
||||||
|
|
||||||
if ($this->getCommitId() != 'Manual') {
|
if (!empty($this->getCommitId())) {
|
||||||
$cmd .= ' -r %s %s "%s"';
|
$cmd .= ' -r %s %s "%s"';
|
||||||
$success = $builder->executeCommand($cmd, $this->getCommitId(), $this->getCloneUrl(), $cloneTo);
|
$success = $builder->executeCommand($cmd, $this->getCommitId(), $this->getCloneUrl(), $cloneTo);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -36,11 +36,12 @@ class BuildService
|
||||||
/**
|
/**
|
||||||
* @param Project $project
|
* @param Project $project
|
||||||
* @param string $environment
|
* @param string $environment
|
||||||
* @param string|null $commitId
|
* @param string $commitId
|
||||||
* @param string|null $branch
|
* @param string|null $branch
|
||||||
* @param string|null $tag
|
* @param string|null $tag
|
||||||
* @param string|null $committerEmail
|
* @param string|null $committerEmail
|
||||||
* @param string|null $commitMessage
|
* @param string|null $commitMessage
|
||||||
|
* @param integer $source
|
||||||
* @param string|null $extra
|
* @param string|null $extra
|
||||||
*
|
*
|
||||||
* @return \PHPCensor\Model\Build
|
* @return \PHPCensor\Model\Build
|
||||||
|
@ -48,11 +49,12 @@ class BuildService
|
||||||
public function createBuild(
|
public function createBuild(
|
||||||
Project $project,
|
Project $project,
|
||||||
$environment,
|
$environment,
|
||||||
$commitId = null,
|
$commitId = '',
|
||||||
$branch = null,
|
$branch = null,
|
||||||
$tag = null,
|
$tag = null,
|
||||||
$committerEmail = null,
|
$committerEmail = null,
|
||||||
$commitMessage = null,
|
$commitMessage = null,
|
||||||
|
$source = Build::SOURCE_UNKNOWN,
|
||||||
$extra = null
|
$extra = null
|
||||||
) {
|
) {
|
||||||
$build = new Build();
|
$build = new Build();
|
||||||
|
@ -64,12 +66,8 @@ class BuildService
|
||||||
$branches = $project->getBranchesByEnvironment($environment);
|
$branches = $project->getBranchesByEnvironment($environment);
|
||||||
$build->setExtraValue('branches', $branches);
|
$build->setExtraValue('branches', $branches);
|
||||||
|
|
||||||
if (!empty($commitId)) {
|
$build->setSource($source);
|
||||||
$build->setCommitId($commitId);
|
$build->setCommitId((string)$commitId);
|
||||||
} else {
|
|
||||||
$build->setCommitId('Manual');
|
|
||||||
$build->setCommitMessage('Manual');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($branch)) {
|
if (!empty($branch)) {
|
||||||
$build->setBranch($branch);
|
$build->setBranch($branch);
|
||||||
|
@ -94,8 +92,7 @@ class BuildService
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var Build $build */
|
/** @var Build $build */
|
||||||
$build = $this->buildStore->save($build);
|
$build = $this->buildStore->save($build);
|
||||||
|
|
||||||
$buildId = $build->getId();
|
$buildId = $build->getId();
|
||||||
|
|
||||||
if (!empty($buildId)) {
|
if (!empty($buildId)) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ class BuildMetaStore extends Store
|
||||||
public function getErrorsForUpgrade($limit)
|
public function getErrorsForUpgrade($limit)
|
||||||
{
|
{
|
||||||
$query = 'SELECT * FROM {{build_meta}}
|
$query = 'SELECT * FROM {{build_meta}}
|
||||||
WHERE {{meta_key}} IN (\'phpmd-data\', \'phpcs-data\', \'phpdoccheck-data\', \'technical_debt - data\')
|
WHERE {{meta_key}} IN (\'phpmd-data\', \'phpcs-data\', \'phpdoccheck-data\', \'technical_debt-data\')
|
||||||
ORDER BY {{id}} ASC LIMIT :limit';
|
ORDER BY {{id}} ASC LIMIT :limit';
|
||||||
|
|
||||||
$stmt = Database::getConnection('read')->prepareCommon($query);
|
$stmt = Database::getConnection('read')->prepareCommon($query);
|
||||||
|
|
|
@ -117,6 +117,34 @@ class BuildStore extends Store
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param integer $limit
|
||||||
|
* @param integer $offset
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getBuilds($limit = 5, $offset = 0)
|
||||||
|
{
|
||||||
|
$query = 'SELECT * FROM {{build}} ORDER BY {{id}} DESC LIMIT :limit OFFSET :offset';
|
||||||
|
$stmt = Database::getConnection('read')->prepareCommon($query);
|
||||||
|
|
||||||
|
$stmt->bindValue(':limit', $limit, \PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':offset', $offset, \PDO::PARAM_INT);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$map = function ($item) {
|
||||||
|
return new Build($item);
|
||||||
|
};
|
||||||
|
$rtn = array_map($map, $res);
|
||||||
|
|
||||||
|
return $rtn;
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of the latest builds for a given project.
|
* Return an array of the latest builds for a given project.
|
||||||
* @param null $projectId
|
* @param null $projectId
|
||||||
|
|
|
@ -78,10 +78,16 @@
|
||||||
|
|
||||||
<div class="box-body no-padding">
|
<div class="box-body no-padding">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th><?php Lang::out('build_source'); ?></th>
|
||||||
|
<td style="text-align: right">
|
||||||
|
<?php Lang::out($build->getSourceHumanize()); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php Lang::out('commit'); ?></th>
|
<th><?php Lang::out('commit'); ?></th>
|
||||||
<td style="text-align: right">
|
<td style="text-align: right">
|
||||||
<a target="_blank" href="<?php print $build->getCommitLink(); ?>">
|
<a target="_blank" href="<?= $build->getCommitLink(); ?>">
|
||||||
<?php print substr($build->getCommitId(), 0, 7); ?>
|
<?php print substr($build->getCommitId(), 0, 7); ?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
<strong>Branch: </strong> <?php print $latest->getBranch(); ?><br />
|
<strong>Branch: </strong> <?php print $latest->getBranch(); ?><br />
|
||||||
<strong>Committer: </strong> <?php print $latest->getCommitterEmail(); ?>
|
<strong>Committer: </strong> <?php print $latest->getCommitterEmail(); ?>
|
||||||
|
|
||||||
<?php if ($latest->getCommitId() != 'Manual'): ?>
|
<?php if (!empty($latest->getCommitId())): ?>
|
||||||
<br /><strong>Commit: </strong> <?php print $latest->getCommitId(); ?><br>
|
<br /><strong>Commit: </strong> <?php print $latest->getCommitId(); ?><br>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</p>
|
</p>
|
||||||
|
@ -145,15 +145,15 @@
|
||||||
<td><?= $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
|
<td><?= $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
if ($build->getCommitId() !== 'Manual') {
|
if (!empty($build->getCommitId())) {
|
||||||
print sprintf(
|
print sprintf(
|
||||||
'<a href="%s" target="_blank">%s (%s)</a>',
|
'<a href="%s" target="_blank">%s %s</a>',
|
||||||
$build->getCommitLink(),
|
$build->getCommitLink(),
|
||||||
substr($build->getCommitId(), 0, 7),
|
substr($build->getCommitId(), 0, 7),
|
||||||
$build->getCommitterEmail()
|
$build->getCommitterEmail() ? ('(' . $build->getCommitterEmail() . ')') : ''
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
print 'Manual';
|
print '—';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -74,7 +74,7 @@ use PHPCensor\Model\Build;
|
||||||
Build #<?= $build->getId(); ?>
|
Build #<?= $build->getId(); ?>
|
||||||
</a>
|
</a>
|
||||||
—
|
—
|
||||||
<?php print $label; ?>
|
<?php Lang::out($build->getSourceHumanize()); ?>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="timeline-body">
|
<div class="timeline-body">
|
||||||
|
@ -85,21 +85,21 @@ use PHPCensor\Model\Build;
|
||||||
<i class="fa fa-tag"></i> <?= $tag; ?>
|
<i class="fa fa-tag"></i> <?= $tag; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
—
|
|
||||||
<?php
|
<?php
|
||||||
if ($build->getCommitId() !== 'Manual') {
|
if (!empty($build->getCommitId())) {
|
||||||
print sprintf(
|
echo ' — ';
|
||||||
'<a href="%s" target="_blank">%s (%s)</a>',
|
echo sprintf(
|
||||||
$build->getCommitLink(),
|
'<a href="%s" target="_blank">%s %s</a>',
|
||||||
substr($build->getCommitId(), 0, 7),
|
$build->getCommitLink(),
|
||||||
$build->getCommitterEmail()
|
substr($build->getCommitId(), 0, 7),
|
||||||
);
|
$build->getCommitterEmail() ? ('(' . $build->getCommitterEmail() . ')') : ''
|
||||||
} else {
|
);
|
||||||
print Lang::get('manual_build');
|
if (!empty($build->getCommitMessage())) {
|
||||||
}
|
echo ' — ';
|
||||||
|
print $build->getCommitMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
—
|
|
||||||
<?php print $build->getCommitMessage(); ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -104,8 +104,8 @@ use PHPCensor\Model\Build;
|
||||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>">
|
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>">
|
||||||
Build #<?= $build->getId(); ?>
|
Build #<?= $build->getId(); ?>
|
||||||
</a>
|
</a>
|
||||||
—
|
—
|
||||||
<?= $label; ?>
|
<?php Lang::out($build->getSourceHumanize()); ?>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="timeline-body">
|
<div class="timeline-body">
|
||||||
|
@ -116,21 +116,21 @@ use PHPCensor\Model\Build;
|
||||||
<i class="fa fa-tag"></i> <?= $tag; ?>
|
<i class="fa fa-tag"></i> <?= $tag; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
—
|
|
||||||
<?php
|
<?php
|
||||||
if ($build->getCommitId() !== 'Manual') {
|
if (!empty($build->getCommitId())) {
|
||||||
print sprintf(
|
echo ' — ';
|
||||||
'<a href="%s" target="_blank">%s (%s)</a>',
|
echo sprintf(
|
||||||
$build->getCommitLink(),
|
'<a href="%s" target="_blank">%s %s</a>',
|
||||||
substr($build->getCommitId(), 0, 7),
|
$build->getCommitLink(),
|
||||||
$build->getCommitterEmail()
|
substr($build->getCommitId(), 0, 7),
|
||||||
);
|
$build->getCommitterEmail() ? ('(' . $build->getCommitterEmail() . ')') : ''
|
||||||
} else {
|
);
|
||||||
print Lang::get('manual_build');
|
if (!empty($build->getCommitMessage())) {
|
||||||
}
|
echo ' — ';
|
||||||
|
print $build->getCommitMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
—
|
|
||||||
<?php print $build->getCommitMessage(); ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -40,20 +40,21 @@ switch($build->getStatus())
|
||||||
$branches = $build->getExtra('branches');
|
$branches = $build->getExtra('branches');
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
|
<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-<?php echo $subcls ?>'><?php echo $status ?></span></td>
|
<td><span class='label label-<?= $subcls ?>'><?= $status ?></span></td>
|
||||||
<td><?php print $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
|
<td><?= $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
|
||||||
|
<td><?php Lang::out($build->getSourceHumanize()); ?></td>
|
||||||
<td class="hidden-md hidden-sm hidden-xs">
|
<td class="hidden-md hidden-sm hidden-xs">
|
||||||
<?php
|
<?php
|
||||||
if ($build->getCommitId() !== 'Manual') {
|
if (!empty($build->getCommitId())) {
|
||||||
print sprintf(
|
print sprintf(
|
||||||
'<a href="%s" target="_blank">%s (%s)</a>',
|
'<a href="%s" target="_blank">%s %s</a>',
|
||||||
$build->getCommitLink(),
|
$build->getCommitLink(),
|
||||||
substr($build->getCommitId(), 0, 7),
|
substr($build->getCommitId(), 0, 7),
|
||||||
$build->getCommitterEmail()
|
$build->getCommitterEmail() ? ('(' . $build->getCommitterEmail() . ')') : ''
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
print Lang::get('manual_build');
|
print '—';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -103,6 +103,7 @@
|
||||||
<th><?php Lang::out('id'); ?></th>
|
<th><?php Lang::out('id'); ?></th>
|
||||||
<th><?php Lang::out('status'); ?></th>
|
<th><?php Lang::out('status'); ?></th>
|
||||||
<th><?php Lang::out('date'); ?></th>
|
<th><?php Lang::out('date'); ?></th>
|
||||||
|
<th><?php Lang::out('build_source'); ?></th>
|
||||||
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
|
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
|
||||||
<th><?php Lang::out('branch'); ?></th>
|
<th><?php Lang::out('branch'); ?></th>
|
||||||
<th><?php Lang::out('environment'); ?></th>
|
<th><?php Lang::out('environment'); ?></th>
|
||||||
|
|
|
@ -65,12 +65,13 @@ class BuildServiceTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->assertNull($returnValue->getStarted());
|
$this->assertNull($returnValue->getStarted());
|
||||||
$this->assertNull($returnValue->getFinished());
|
$this->assertNull($returnValue->getFinished());
|
||||||
$this->assertNull($returnValue->getLog());
|
$this->assertNull($returnValue->getLog());
|
||||||
$this->assertEquals('Manual', $returnValue->getCommitMessage());
|
$this->assertEquals(null, $returnValue->getCommitMessage());
|
||||||
$this->assertNull($returnValue->getCommitterEmail());
|
$this->assertNull($returnValue->getCommitterEmail());
|
||||||
$this->assertEquals(['branches' => []], $returnValue->getExtra());
|
$this->assertEquals(['branches' => []], $returnValue->getExtra());
|
||||||
$this->assertEquals('master', $returnValue->getBranch());
|
$this->assertEquals('master', $returnValue->getBranch());
|
||||||
$this->assertInstanceOf('DateTime', $returnValue->getCreated());
|
$this->assertInstanceOf('DateTime', $returnValue->getCreated());
|
||||||
$this->assertEquals('Manual', $returnValue->getCommitId());
|
$this->assertEquals('', $returnValue->getCommitId());
|
||||||
|
$this->assertEquals(Build::SOURCE_UNKNOWN, $returnValue->getSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExecute_CreateBuildWithOptions()
|
public function testExecute_CreateBuildWithOptions()
|
||||||
|
@ -120,11 +121,12 @@ class BuildServiceTest extends \PHPUnit\Framework\TestCase
|
||||||
$returnValue = $this->testedService->createBuild(
|
$returnValue = $this->testedService->createBuild(
|
||||||
$project,
|
$project,
|
||||||
null,
|
null,
|
||||||
|
'',
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
Build::SOURCE_UNKNOWN,
|
||||||
['item1' => 1001]
|
['item1' => 1001]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue