Fixed debug build from GUI for environments
This commit is contained in:
parent
9f4e92fe68
commit
a3ef15b488
|
@ -570,7 +570,6 @@ class Build extends Model
|
|||
/**
|
||||
* Set the values of Extra / extra.
|
||||
*
|
||||
* @param $name string
|
||||
* @param $values mixed
|
||||
*/
|
||||
public function setExtraValues($values)
|
||||
|
@ -583,6 +582,26 @@ class Build extends Model
|
|||
$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)
|
||||
{
|
||||
$data = json_decode($this->data['extra'], true);
|
||||
|
||||
if (is_null($key)) {
|
||||
$rtn = $data;
|
||||
} elseif (isset($data[$key])) {
|
||||
$rtn = $data[$key];
|
||||
} else {
|
||||
$rtn = null;
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Project model for this Build by Id.
|
||||
*
|
||||
|
@ -801,26 +820,6 @@ class Build extends Model
|
|||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a value from the build's "extra" JSON array.
|
||||
* @param null $key
|
||||
* @return mixed|null|string
|
||||
*/
|
||||
public function getExtra($key = null)
|
||||
{
|
||||
$data = json_decode($this->data['extra'], true);
|
||||
|
||||
if (is_null($key)) {
|
||||
$rtn = $data;
|
||||
} elseif (isset($data[$key])) {
|
||||
$rtn = $data[$key];
|
||||
} else {
|
||||
$rtn = null;
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the commit message for this build.
|
||||
* @return string
|
||||
|
|
|
@ -142,7 +142,7 @@ class Environment extends Model
|
|||
/**
|
||||
* Get the value of Title / title.
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function getBranches()
|
||||
{
|
||||
|
|
|
@ -34,13 +34,14 @@ class BuildService
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Project $project
|
||||
* @param string $environment
|
||||
* @param Project $project
|
||||
* @param string $environment
|
||||
* @param string|null $commitId
|
||||
* @param string|null $branch
|
||||
* @param string|null $committerEmail
|
||||
* @param string|null $commitMessage
|
||||
* @param string|null $extra
|
||||
*
|
||||
* @return \PHPCensor\Model\Build
|
||||
*/
|
||||
public function createBuild(
|
||||
|
|
|
@ -25,20 +25,20 @@
|
|||
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<?php if(!empty($environments)): ?>
|
||||
<?php foreach ($environments as $curenvironment) : ?>
|
||||
<li <?php echo ($curenvironment == $environment) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/environment/<?php echo urlencode($curenvironment) ?>?debug=1">
|
||||
<i class="fa fa-cog"></i><?php echo $curenvironment ?>
|
||||
<?php foreach ($environments as $currentEnvironment) : ?>
|
||||
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/environment/<?php echo urlencode($currentEnvironment) ?>?debug=1">
|
||||
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="divider"></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($branches as $curbranch) : ?>
|
||||
<li <?php echo ($curbranch == $branch) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/branch/<?php echo urlencode($curbranch) ?>">
|
||||
<i class="fa fa-code-fork"></i><?php echo $curbranch ?>
|
||||
<?php foreach ($branches as $currentBranch) : ?>
|
||||
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/branch/<?php echo urlencode($currentBranch) ?>?debug=1">
|
||||
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -53,20 +53,20 @@
|
|||
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<?php if(!empty($environments)): ?>
|
||||
<?php foreach ($environments as $curenvironment) : ?>
|
||||
<li <?php echo ($curenvironment == $environment) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/environment/<?php echo urlencode($curenvironment) ?>">
|
||||
<i class="fa fa-cog"></i><?php echo $curenvironment ?>
|
||||
<?php foreach ($environments as $currentEnvironment) : ?>
|
||||
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/environment/<?php echo urlencode($currentEnvironment) ?>">
|
||||
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="divider"></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($branches as $curbranch) : ?>
|
||||
<li <?php echo ($curbranch == $branch) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/branch/<?php echo urlencode($curbranch) ?>">
|
||||
<i class="fa fa-code-fork"></i><?php echo $curbranch ?>
|
||||
<?php foreach ($branches as $currentBranch) : ?>
|
||||
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/branch/<?php echo urlencode($currentBranch) ?>">
|
||||
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -92,20 +92,20 @@
|
|||
<li class="divider"></li>
|
||||
|
||||
<?php if(!empty($environments)): ?>
|
||||
<?php foreach ($environments as $curenvironment) : ?>
|
||||
<li <?php echo ($curenvironment == $environment) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?environment=<?php echo urlencode($curenvironment) ?>">
|
||||
<i class="fa fa-cog"></i><?php echo $curenvironment ?>
|
||||
<?php foreach ($environments as $currentEnvironment) : ?>
|
||||
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?environment=<?php echo urlencode($currentEnvironment) ?>">
|
||||
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="divider"></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($branches as $curbranch) : ?>
|
||||
<li <?php echo ($curbranch == $branch) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?branch=<?php echo urlencode($curbranch) ?>">
|
||||
<i class="fa fa-code-fork"></i><?php echo $curbranch ?>
|
||||
<?php foreach ($branches as $currentBranch) : ?>
|
||||
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
|
||||
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?branch=<?php echo urlencode($currentBranch) ?>">
|
||||
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -61,5 +61,26 @@ class BuildTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(2, $build->getExtra('item2'));
|
||||
$this->assertNull($build->getExtra('item3'));
|
||||
$this->assertEquals($info, $build->getExtra());
|
||||
|
||||
$build->setExtraValue('item3', 'Item Three');
|
||||
|
||||
$this->assertEquals('Item One', $build->getExtra('item1'));
|
||||
$this->assertEquals('Item Three', $build->getExtra('item3'));
|
||||
|
||||
$build->setExtraValues([
|
||||
'item3' => 'Item Three New',
|
||||
'item4' => 4,
|
||||
]);
|
||||
|
||||
$this->assertEquals('Item One', $build->getExtra('item1'));
|
||||
$this->assertEquals('Item Three New', $build->getExtra('item3'));
|
||||
$this->assertEquals(4, $build->getExtra('item4'));
|
||||
|
||||
$this->assertEquals([
|
||||
'item1' => 'Item One',
|
||||
'item2' => 2,
|
||||
'item3' => 'Item Three New',
|
||||
'item4' => 4,
|
||||
], $build->getExtra());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue