Added unit tests for base models.

This commit is contained in:
Dmitry Khomutov 2018-03-11 12:13:28 +07:00
commit ad7670e81e
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
16 changed files with 1312 additions and 152 deletions

View file

@ -50,6 +50,8 @@ class Build extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setId($value)
{
@ -57,12 +59,12 @@ class Build extends Model
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
return false;
}
$this->data['id'] = (integer)$value;
$this->setModified('id');
return $this->setModified('id');
}
/**
@ -75,6 +77,8 @@ class Build extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setProjectId($value)
{
@ -82,12 +86,12 @@ class Build extends Model
$this->validateInt('project_id', $value);
if ($this->data['project_id'] === $value) {
return;
return false;
}
$this->data['project_id'] = $value;
$this->setModified('project_id');
return $this->setModified('project_id');
}
/**
@ -100,6 +104,8 @@ class Build extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setCommitId($value)
{
@ -107,12 +113,12 @@ class Build extends Model
$this->validateString('commit_id', $value);
if ($this->data['commit_id'] === $value) {
return;
return false;
}
$this->data['commit_id'] = $value;
$this->setModified('commit_id');
return $this->setModified('commit_id');
}
/**
@ -125,6 +131,8 @@ class Build extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setStatus($value)
{
@ -132,12 +140,12 @@ class Build extends Model
$this->validateInt('status', $value);
if ($this->data['status'] === $value) {
return;
return false;
}
$this->data['status'] = $value;
$this->setModified('status');
return $this->setModified('status');
}
/**
@ -150,18 +158,20 @@ class Build extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setLog($value)
{
$this->validateString('log', $value);
if ($this->data['log'] === $value) {
return;
return false;
}
$this->data['log'] = $value;
$this->setModified('log');
return $this->setModified('log');
}
/**
@ -174,6 +184,8 @@ class Build extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setBranch($value)
{
@ -181,12 +193,12 @@ class Build extends Model
$this->validateString('branch', $value);
if ($this->data['branch'] === $value) {
return;
return false;
}
$this->data['branch'] = $value;
$this->setModified('branch');
return $this->setModified('branch');
}
/**
@ -199,18 +211,20 @@ class Build extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setTag($value)
{
$this->validateString('tag', $value);
if ($this->data['tag'] === $value) {
return;
return false;
}
$this->data['tag'] = $value;
$this->setModified('tag');
return $this->setModified('tag');
}
/**
@ -227,18 +241,20 @@ class Build extends Model
/**
* @param \DateTime $value
*
* @return boolean
*/
public function setCreateDate(\DateTime $value)
{
$stringValue = $value->format('Y-m-d H:i:s');
if ($this->data['create_date'] === $stringValue) {
return;
return false;
}
$this->data['create_date'] = $stringValue;
$this->setModified('create_date');
return $this->setModified('create_date');
}
/**
@ -255,18 +271,20 @@ class Build extends Model
/**
* @param \DateTime $value
*
* @return boolean
*/
public function setStartDate(\DateTime $value)
{
$stringValue = $value->format('Y-m-d H:i:s');
if ($this->data['start_date'] === $stringValue) {
return;
return false;
}
$this->data['start_date'] = $stringValue;
$this->setModified('start_date');
return $this->setModified('start_date');
}
/**
@ -283,18 +301,20 @@ class Build extends Model
/**
* @param \DateTime $value
*
* @return boolean
*/
public function setFinishDate(\DateTime $value)
{
$stringValue = $value->format('Y-m-d H:i:s');
if ($this->data['finish_date'] === $stringValue) {
return;
return false;
}
$this->data['finish_date'] = $stringValue;
$this->setModified('finish_date');
return $this->setModified('finish_date');
}
/**
@ -307,18 +327,20 @@ class Build extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setCommitterEmail($value)
{
$this->validateString('committer_email', $value);
if ($this->data['committer_email'] === $value) {
return;
return false;
}
$this->data['committer_email'] = $value;
$this->setModified('committer_email');
return $this->setModified('committer_email');
}
/**
@ -331,18 +353,20 @@ class Build extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setCommitMessage($value)
{
$this->validateString('commit_message', $value);
if ($this->data['commit_message'] === $value) {
return;
return false;
}
$this->data['commit_message'] = $value;
$this->setModified('commit_message');
return $this->setModified('commit_message');
}
/**
@ -365,6 +389,8 @@ class Build extends Model
/**
* @param array $value
*
* @return boolean
*/
public function setExtra(array $value)
{
@ -372,12 +398,12 @@ class Build extends Model
$extra = json_encode($value);
if ($this->data['extra'] === $extra) {
return;
return false;
}
$this->data['extra'] = $extra;
$this->setModified('extra');
return $this->setModified('extra');
}
/**
@ -390,18 +416,20 @@ class Build extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setEnvironment($value)
{
$this->validateString('environment', $value);
if ($this->data['environment'] === $value) {
return;
return false;
}
$this->data['environment'] = $value;
$this->setModified('environment');
return $this->setModified('environment');
}
/**
@ -414,18 +442,20 @@ class Build extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setSource($value)
{
$this->validateInt('source', $value);
if ($this->data['source'] === $value) {
return;
return false;
}
$this->data['source'] = $value;
$this->setModified('source');
return $this->setModified('source');
}
/**
@ -438,6 +468,8 @@ class Build extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setUserId($value)
{
@ -445,11 +477,11 @@ class Build extends Model
$this->validateInt('user_id', $value);
if ($this->data['user_id'] === $value) {
return;
return false;
}
$this->data['user_id'] = $value;
$this->setModified('user_id');
return $this->setModified('user_id');
}
}

View file

@ -6,6 +6,11 @@ use PHPCensor\Model;
class BuildError extends Model
{
const SEVERITY_CRITICAL = 0;
const SEVERITY_HIGH = 1;
const SEVERITY_NORMAL = 2;
const SEVERITY_LOW = 3;
/**
* @var string
*/
@ -15,17 +20,17 @@ class BuildError extends Model
* @var array
*/
protected $data = [
'id' => null,
'build_id' => null,
'plugin' => null,
'file' => null,
'line_start' => null,
'line_end' => null,
'severity' => null,
'message' => null,
'create_date' => null,
'hash' => null,
'is_new' => null,
'id' => null,
'build_id' => null,
'plugin' => null,
'file' => null,
'line_start' => null,
'line_end' => null,
'severity' => null,
'message' => null,
'create_date' => null,
'hash' => null,
'is_new' => null,
];
/**
@ -38,6 +43,8 @@ class BuildError extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setId($value)
{
@ -45,12 +52,12 @@ class BuildError extends Model
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
return false;
}
$this->data['id'] = $value;
$this->setModified('id');
return $this->setModified('id');
}
/**
@ -63,6 +70,8 @@ class BuildError extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setBuildId($value)
{
@ -70,12 +79,12 @@ class BuildError extends Model
$this->validateInt('build_id', $value);
if ($this->data['build_id'] === $value) {
return;
return false;
}
$this->data['build_id'] = $value;
$this->setModified('build_id');
return $this->setModified('build_id');
}
/**
@ -88,6 +97,8 @@ class BuildError extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setPlugin($value)
{
@ -95,12 +106,12 @@ class BuildError extends Model
$this->validateString('plugin', $value);
if ($this->data['plugin'] === $value) {
return;
return false;
}
$this->data['plugin'] = $value;
$this->setModified('plugin');
return $this->setModified('plugin');
}
/**
@ -113,18 +124,20 @@ class BuildError extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setFile($value)
{
$this->validateString('file', $value);
if ($this->data['file'] === $value) {
return;
return false;
}
$this->data['file'] = $value;
$this->setModified('file');
return $this->setModified('file');
}
/**
@ -137,18 +150,20 @@ class BuildError extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setLineStart($value)
{
$this->validateInt('line_start', $value);
if ($this->data['line_start'] === $value) {
return;
return false;
}
$this->data['line_start'] = $value;
$this->setModified('line_start');
return $this->setModified('line_start');
}
/**
@ -161,18 +176,20 @@ class BuildError extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setLineEnd($value)
{
$this->validateInt('line_end', $value);
if ($this->data['line_end'] === $value) {
return;
return false;
}
$this->data['line_end'] = $value;
$this->setModified('line_end');
return $this->setModified('line_end');
}
/**
@ -185,6 +202,8 @@ class BuildError extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setSeverity($value)
{
@ -192,12 +211,12 @@ class BuildError extends Model
$this->validateInt('severity', $value);
if ($this->data['severity'] === $value) {
return;
return false;
}
$this->data['severity'] = $value;
$this->setModified('severity');
return $this->setModified('severity');
}
/**
@ -210,6 +229,8 @@ class BuildError extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setMessage($value)
{
@ -217,12 +238,12 @@ class BuildError extends Model
$this->validateString('message', $value);
if ($this->data['message'] === $value) {
return;
return false;
}
$this->data['message'] = $value;
$this->setModified('message');
return $this->setModified('message');
}
/**
@ -239,6 +260,8 @@ class BuildError extends Model
/**
* @param \DateTime $value
*
* @return boolean
*/
public function setCreateDate(\DateTime $value)
{
@ -247,12 +270,12 @@ class BuildError extends Model
$stringValue = $value->format('Y-m-d H:i:s');
if ($this->data['create_date'] === $stringValue) {
return;
return false;
}
$this->data['create_date'] = $stringValue;
$this->setModified('create_date');
return $this->setModified('create_date');
}
/**
@ -265,6 +288,8 @@ class BuildError extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setHash($value)
{
@ -272,12 +297,12 @@ class BuildError extends Model
$this->validateString('hash', $value);
if ($this->data['hash'] === $value) {
return;
return false;
}
$this->data['hash'] = $value;
$this->setModified('hash');
return $this->setModified('hash');
}
/**
@ -290,18 +315,20 @@ class BuildError extends Model
/**
* @param boolean $value
*
* @return boolean
*/
public function setIsNew($value)
{
$this->validateNotNull('is_new', $value);
$this->validateBoolean('is_new', $value);
if ($this->data['is_new'] === $value) {
return;
if ($this->data['is_new'] === (integer)$value) {
return false;
}
$this->data['is_new'] = (integer)$value;
$this->setModified('is_new');
return $this->setModified('is_new');
}
}

View file

@ -31,6 +31,8 @@ class BuildMeta extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setId($value)
{
@ -38,12 +40,12 @@ class BuildMeta extends Model
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
return false;
}
$this->data['id'] = $value;
$this->setModified('id');
return $this->setModified('id');
}
/**
@ -56,6 +58,8 @@ class BuildMeta extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setBuildId($value)
{
@ -63,12 +67,12 @@ class BuildMeta extends Model
$this->validateInt('build_id', $value);
if ($this->data['build_id'] === $value) {
return;
return false ;
}
$this->data['build_id'] = $value;
$this->setModified('build_id');
return $this->setModified('build_id');
}
/**
@ -81,6 +85,8 @@ class BuildMeta extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setMetaKey($value)
{
@ -88,12 +94,12 @@ class BuildMeta extends Model
$this->validateString('meta_key', $value);
if ($this->data['meta_key'] === $value) {
return;
return false;
}
$this->data['meta_key'] = $value;
$this->setModified('meta_key');
return $this->setModified('meta_key');
}
/**
@ -106,6 +112,8 @@ class BuildMeta extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setMetaValue($value)
{
@ -113,11 +121,11 @@ class BuildMeta extends Model
$this->validateString('meta_value', $value);
if ($this->data['meta_value'] === $value) {
return;
return false;
}
$this->data['meta_value'] = $value;
$this->setModified('meta_value');
return $this->setModified('meta_value');
}
}

View file

@ -31,6 +31,8 @@ class Environment extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setId($value)
{
@ -38,12 +40,12 @@ class Environment extends Model
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
return false;
}
$this->data['id'] = $value;
$this->setModified('id');
return $this->setModified('id');
}
/**
@ -56,6 +58,8 @@ class Environment extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setProjectId($value)
{
@ -63,12 +67,12 @@ class Environment extends Model
$this->validateInt('project_id', $value);
if ($this->data['project_id'] === $value) {
return;
return false;
}
$this->data['project_id'] = $value;
$this->setModified('project_id');
return $this->setModified('project_id');
}
/**
@ -81,6 +85,8 @@ class Environment extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setName($value)
{
@ -88,12 +94,12 @@ class Environment extends Model
$this->validateString('name', $value);
if ($this->data['name'] === $value) {
return;
return false;
}
$this->data['name'] = $value;
$this->setModified('name');
return $this->setModified('name');
}
/**
@ -111,6 +117,8 @@ class Environment extends Model
/**
* @param array $value
*
* @return boolean
*/
public function setBranches(array $value)
{
@ -118,11 +126,11 @@ class Environment extends Model
$branches = implode("\n", $value);
if ($this->data['branches'] === $branches) {
return;
return false;
}
$this->data['branches'] = $branches;
$this->setModified('branches');
return $this->setModified('branches');
}
}

View file

@ -43,6 +43,8 @@ class Project extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setId($value)
{
@ -50,12 +52,12 @@ class Project extends Model
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
return false;
}
$this->data['id'] = $value;
$this->setModified('id');
return $this->setModified('id');
}
/**
@ -68,6 +70,8 @@ class Project extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setTitle($value)
{
@ -75,12 +79,12 @@ class Project extends Model
$this->validateString('title', $value);
if ($this->data['title'] === $value) {
return;
return false;
}
$this->data['title'] = $value;
$this->setModified('title');
return $this->setModified('title');
}
/**
@ -93,6 +97,8 @@ class Project extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setReference($value)
{
@ -100,12 +106,12 @@ class Project extends Model
$this->validateString('reference', $value);
if ($this->data['reference'] === $value) {
return;
return false;
}
$this->data['reference'] = $value;
$this->setModified('reference');
return $this->setModified('reference');
}
/**
@ -134,6 +140,8 @@ class Project extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setBranch($value)
{
@ -141,12 +149,12 @@ class Project extends Model
$this->validateString('branch', $value);
if ($this->data['branch'] === $value) {
return;
return false;
}
$this->data['branch'] = $value;
$this->setModified('branch');
return $this->setModified('branch');
}
/**
@ -159,19 +167,21 @@ class Project extends Model
/**
* @param boolean $value
*
* @return boolean
*/
public function setDefaultBranchOnly($value)
{
$this->validateNotNull('default_branch_only', $value);
$this->validateBoolean('default_branch_only', $value);
if ($this->data['default_branch_only'] === $value) {
return;
if ($this->data['default_branch_only'] === (integer)$value) {
return false;
}
$this->data['default_branch_only'] = (integer)$value;
$this->setModified('default_branch_only');
return $this->setModified('default_branch_only');
}
/**
@ -184,18 +194,20 @@ class Project extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setSshPrivateKey($value)
{
$this->validateString('ssh_private_key', $value);
if ($this->data['ssh_private_key'] === $value) {
return;
return false;
}
$this->data['ssh_private_key'] = $value;
$this->setModified('ssh_private_key');
return $this->setModified('ssh_private_key');
}
/**
@ -208,18 +220,20 @@ class Project extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setSshPublicKey($value)
{
$this->validateString('ssh_public_key', $value);
if ($this->data['ssh_public_key'] === $value) {
return;
return false;
}
$this->data['ssh_public_key'] = $value;
$this->setModified('ssh_public_key');
return $this->setModified('ssh_public_key');
}
/**
@ -232,6 +246,8 @@ class Project extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setType($value)
{
@ -239,12 +255,12 @@ class Project extends Model
$this->validateString('type', $value);
if ($this->data['type'] === $value) {
return;
return false;
}
$this->data['type'] = $value;
$this->setModified('type');
return $this->setModified('type');
}
/**
@ -267,6 +283,8 @@ class Project extends Model
/**
* @param array $value
*
* @return boolean
*/
public function setAccessInformation(array $value)
{
@ -274,12 +292,12 @@ class Project extends Model
$accessInformation = json_encode($value);
if ($this->data['access_information'] === $accessInformation) {
return;
return false;
}
$this->data['access_information'] = $accessInformation;
$this->setModified('access_information');
return $this->setModified('access_information');
}
@ -293,18 +311,20 @@ class Project extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setLastCommit($value)
{
$this->validateString('last_commit', $value);
if ($this->data['last_commit'] === $value) {
return;
return false;
}
$this->data['last_commit'] = $value;
$this->setModified('last_commit');
return $this->setModified('last_commit');
}
/**
@ -317,18 +337,20 @@ class Project extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setBuildConfig($value)
{
$this->validateString('build_config', $value);
if ($this->data['build_config'] === $value) {
return;
return false;
}
$this->data['build_config'] = $value;
$this->setModified('build_config');
return $this->setModified('build_config');
}
/**
@ -341,19 +363,21 @@ class Project extends Model
/**
* @param boolean $value
*
* @return boolean
*/
public function setAllowPublicStatus($value)
{
$this->validateNotNull('allow_public_status', $value);
$this->validateBoolean('allow_public_status', $value);
if ($this->data['allow_public_status'] === $value) {
return;
if ($this->data['allow_public_status'] === (integer)$value) {
return false;
}
$this->data['allow_public_status'] = (integer)$value;
$this->setModified('allow_public_status');
return $this->setModified('allow_public_status');
}
/**
@ -366,19 +390,21 @@ class Project extends Model
/**
* @param boolean $value
*
* @return boolean
*/
public function setArchived($value)
{
$this->validateNotNull('archived', $value);
$this->validateBoolean('archived', $value);
if ($this->data['archived'] === $value) {
return;
if ($this->data['archived'] === (integer)$value) {
return false;
}
$this->data['archived'] = (integer)$value;
$this->setModified('archived');
return $this->setModified('archived');
}
/**
@ -391,6 +417,8 @@ class Project extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setGroupId($value)
{
@ -398,12 +426,12 @@ class Project extends Model
$this->validateInt('group_id', $value);
if ($this->data['group_id'] === $value) {
return;
return false;
}
$this->data['group_id'] = $value;
$this->setModified('group_id');
return $this->setModified('group_id');
}
/**
@ -420,18 +448,20 @@ class Project extends Model
/**
* @param \DateTime $value
*
* @return boolean
*/
public function setCreateDate(\DateTime $value)
{
$stringValue = $value->format('Y-m-d H:i:s');
if ($this->data['create_date'] === $stringValue) {
return;
return false;
}
$this->data['create_date'] = $stringValue;
$this->setModified('create_date');
return $this->setModified('create_date');
}
/**
@ -444,6 +474,8 @@ class Project extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setUserId($value)
{
@ -451,11 +483,11 @@ class Project extends Model
$this->validateInt('user_id', $value);
if ($this->data['user_id'] === $value) {
return;
return false;
}
$this->data['user_id'] = $value;
$this->setModified('user_id');
return $this->setModified('user_id');
}
}

View file

@ -31,6 +31,8 @@ class ProjectGroup extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setId($value)
{
@ -38,12 +40,12 @@ class ProjectGroup extends Model
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
return false;
}
$this->data['id'] = $value;
$this->setModified('id');
return $this->setModified('id');
}
/**
@ -56,6 +58,8 @@ class ProjectGroup extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setTitle($value)
{
@ -63,12 +67,12 @@ class ProjectGroup extends Model
$this->validateString('title', $value);
if ($this->data['title'] === $value) {
return;
return false;
}
$this->data['title'] = $value;
$this->setModified('title');
return $this->setModified('title');
}
/**
@ -85,18 +89,20 @@ class ProjectGroup extends Model
/**
* @param \DateTime $value
*
* @return boolean
*/
public function setCreateDate(\DateTime $value)
{
$stringValue = $value->format('Y-m-d H:i:s');
if ($this->data['create_date'] === $stringValue) {
return;
return false;
}
$this->data['create_date'] = $stringValue;
$this->setModified('create_date');
return $this->setModified('create_date');
}
/**
@ -109,6 +115,8 @@ class ProjectGroup extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setUserId($value)
{
@ -116,11 +124,11 @@ class ProjectGroup extends Model
$this->validateInt('user_id', $value);
if ($this->data['user_id'] === $value) {
return;
return false;
}
$this->data['user_id'] = $value;
$this->setModified('user_id');
return $this->setModified('user_id');
}
}

View file

@ -37,6 +37,8 @@ class User extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setId($value)
{
@ -44,12 +46,12 @@ class User extends Model
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
return false;
}
$this->data['id'] = $value;
$this->setModified('id');
return $this->setModified('id');
}
/**
@ -62,6 +64,8 @@ class User extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setEmail($value)
{
@ -69,12 +73,12 @@ class User extends Model
$this->validateString('email', $value);
if ($this->data['email'] === $value) {
return;
return false;
}
$this->data['email'] = $value;
$this->setModified('email');
return $this->setModified('email');
}
/**
@ -87,6 +91,8 @@ class User extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setHash($value)
{
@ -94,12 +100,12 @@ class User extends Model
$this->validateString('hash', $value);
if ($this->data['hash'] === $value) {
return;
return false;
}
$this->data['hash'] = $value;
$this->setModified('hash');
return $this->setModified('hash');
}
/**
@ -112,19 +118,21 @@ class User extends Model
/**
* @param boolean $value
*
* @return boolean
*/
public function setIsAdmin($value)
{
$this->validateNotNull('is_admin', $value);
$this->validateBoolean('is_admin', $value);
if ($this->data['is_admin'] === $value) {
return;
if ($this->data['is_admin'] === (integer)$value) {
return false;
}
$this->data['is_admin'] = (integer)$value;
$this->setModified('is_admin');
return $this->setModified('is_admin');
}
/**
@ -137,6 +145,8 @@ class User extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setName($value)
{
@ -144,12 +154,12 @@ class User extends Model
$this->validateString('name', $value);
if ($this->data['name'] === $value) {
return;
return false;
}
$this->data['name'] = $value;
$this->setModified('name');
return $this->setModified('name');
}
/**
@ -162,16 +172,18 @@ class User extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setLanguage($value)
{
if ($this->data['language'] === $value) {
return;
return false;
}
$this->data['language'] = $value;
$this->setModified('language');
return $this->setModified('language');
}
/**
@ -184,18 +196,20 @@ class User extends Model
/**
* @param integer $value
*
* @return boolean
*/
public function setPerPage($value)
{
$this->validateInt('per_page', $value);
if ($this->data['per_page'] === $value) {
return;
return false;
}
$this->data['per_page'] = $value;
$this->setModified('per_page');
return $this->setModified('per_page');
}
/**
@ -208,6 +222,8 @@ class User extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setProviderKey($value)
{
@ -215,12 +231,12 @@ class User extends Model
$this->validateString('provider_key', $value);
if ($this->data['provider_key'] === $value) {
return;
return false;
}
$this->data['provider_key'] = $value;
$this->setModified('provider_key');
return $this->setModified('provider_key');
}
/**
@ -230,7 +246,7 @@ class User extends Model
*/
public function getProviderData($key = null)
{
$data = json_decode($this->data['provider_data'], true);
$data = json_decode($this->data['provider_data'], true);
$providerData = null;
if (is_null($key)) {
$providerData = $data;
@ -243,6 +259,8 @@ class User extends Model
/**
* @param array $value
*
* @return boolean
*/
public function setProviderData(array $value)
{
@ -250,12 +268,12 @@ class User extends Model
$providerData = json_encode($value);
if ($this->data['provider_data'] === $providerData) {
return;
return false;
}
$this->data['provider_data'] = $providerData;
$this->setModified('provider_data');
return $this->setModified('provider_data');
}
/**
@ -268,17 +286,19 @@ class User extends Model
/**
* @param string $value
*
* @return boolean
*/
public function setRememberKey($value)
{
$this->validateString('remember_key', $value);
if ($this->data['remember_key'] === $value) {
return;
return false;
}
$this->data['remember_key'] = $value;
$this->setModified('remember_key');
return $this->setModified('remember_key');
}
}

View file

@ -8,11 +8,6 @@ use PHPCensor\Store\Factory;
class BuildError extends BaseBuildError
{
const SEVERITY_CRITICAL = 0;
const SEVERITY_HIGH = 1;
const SEVERITY_NORMAL = 2;
const SEVERITY_LOW = 3;
/**
* @return Build|null
*/