Fixing PHPCI errors

This commit is contained in:
Dan Cryer 2015-10-15 10:17:22 +01:00
parent 7f823b37cf
commit 38b024833f
5 changed files with 25 additions and 0 deletions

View file

@ -8,6 +8,7 @@ build_settings:
- "PHPCI/Migrations" # Ignore the migrations directory, as both PHPMD and PHPCS can't cope with them. - "PHPCI/Migrations" # Ignore the migrations directory, as both PHPMD and PHPCS can't cope with them.
- "PHPCI/Model/Base" # These files are auto-generated, and sometimes hit PHPMD complexity thresholds. - "PHPCI/Model/Base" # These files are auto-generated, and sometimes hit PHPMD complexity thresholds.
- "PHPCI/Languages" # PHPCS fails on character counts for non-Latin languages - "PHPCI/Languages" # PHPCS fails on character counts for non-Latin languages
- "public/assets" # If there are any PHP files in here, we didn't write them.
setup: setup:
composer: composer:

View file

@ -276,6 +276,10 @@ class Build extends BuildBase
exec(sprintf(IS_WIN ? 'rmdir /S /Q "%s"' : 'rm -Rf "%s"', $buildPath)); exec(sprintf(IS_WIN ? 'rmdir /S /Q "%s"' : 'rm -Rf "%s"', $buildPath));
} }
/**
* Get the number of seconds a build has been running for.
* @return int
*/
public function getDuration() public function getDuration()
{ {
$start = $this->getStarted(); $start = $this->getStarted();

View file

@ -19,6 +19,10 @@ class BuildError extends BuildErrorBase
const SEVERITY_NORMAL = 2; const SEVERITY_NORMAL = 2;
const SEVERITY_LOW = 3; const SEVERITY_LOW = 3;
/**
* Get the language string key for this error's severity level.
* @return string
*/
public function getSeverityString() public function getSeverityString()
{ {
switch ($this->getSeverity()) { switch ($this->getSeverity()) {
@ -36,6 +40,10 @@ class BuildError extends BuildErrorBase
} }
} }
/**
* Get the class to apply to HTML elements representing this error.
* @return string
*/
public function getSeverityClass() public function getSeverityClass()
{ {
switch ($this->getSeverity()) { switch ($this->getSeverity()) {

View file

@ -16,6 +16,12 @@ use PHPCI\Store\Base\BuildErrorStoreBase;
*/ */
class BuildErrorStore extends BuildErrorStoreBase class BuildErrorStore extends BuildErrorStoreBase
{ {
/**
* Get a list of errors for a given build, since a given time.
* @param $buildId
* @param string $since date string
* @return array
*/
public function getErrorsForBuild($buildId, $since = null) public function getErrorsForBuild($buildId, $since = null)
{ {
$query = 'SELECT * FROM build_error $query = 'SELECT * FROM build_error

View file

@ -19,6 +19,12 @@ use PHPCI\Model\BuildMeta;
*/ */
class BuildMetaStore extends BuildMetaStoreBase class BuildMetaStore extends BuildMetaStoreBase
{ {
/**
* Only used by an upgrade migration to move errors from build_meta to build_error
* @param $start
* @param $limit
* @return array
*/
public function getErrorsForUpgrade($start, $limit) public function getErrorsForUpgrade($start, $limit)
{ {
$query = 'SELECT * FROM build_meta $query = 'SELECT * FROM build_meta