Code style fixes
This commit is contained in:
parent
6891b8a75f
commit
047311c481
|
@ -32,163 +32,161 @@ class ProjectBase extends Model
|
|||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
'reference' => null,
|
||||
'branch' => null,
|
||||
'ssh_private_key' => null,
|
||||
'type' => null,
|
||||
'access_information' => null,
|
||||
'last_commit' => null,
|
||||
'build_config' => null,
|
||||
'ssh_public_key' => null,
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
'reference' => null,
|
||||
'branch' => null,
|
||||
'ssh_private_key' => null,
|
||||
'type' => null,
|
||||
'access_information' => null,
|
||||
'last_commit' => null,
|
||||
'build_config' => null,
|
||||
'ssh_public_key' => null,
|
||||
'allow_public_status' => null,
|
||||
'archived' => null,
|
||||
'group_id' => null,
|
||||
);
|
||||
'archived' => null,
|
||||
'group_id' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = array(
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'title' => 'getTitle',
|
||||
'reference' => 'getReference',
|
||||
'branch' => 'getBranch',
|
||||
'ssh_private_key' => 'getSshPrivateKey',
|
||||
'type' => 'getType',
|
||||
'access_information' => 'getAccessInformation',
|
||||
'last_commit' => 'getLastCommit',
|
||||
'build_config' => 'getBuildConfig',
|
||||
'ssh_public_key' => 'getSshPublicKey',
|
||||
'id' => 'getId',
|
||||
'title' => 'getTitle',
|
||||
'reference' => 'getReference',
|
||||
'branch' => 'getBranch',
|
||||
'ssh_private_key' => 'getSshPrivateKey',
|
||||
'type' => 'getType',
|
||||
'access_information' => 'getAccessInformation',
|
||||
'last_commit' => 'getLastCommit',
|
||||
'build_config' => 'getBuildConfig',
|
||||
'ssh_public_key' => 'getSshPublicKey',
|
||||
'allow_public_status' => 'getAllowPublicStatus',
|
||||
'archived' => 'getArchived',
|
||||
'group_id' => 'getGroupId',
|
||||
|
||||
'archived' => 'getArchived',
|
||||
'group_id' => 'getGroupId',
|
||||
// Foreign key getters:
|
||||
'Group' => 'getGroup',
|
||||
);
|
||||
'Group' => 'getGroup',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = array(
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'title' => 'setTitle',
|
||||
'reference' => 'setReference',
|
||||
'branch' => 'setBranch',
|
||||
'ssh_private_key' => 'setSshPrivateKey',
|
||||
'type' => 'setType',
|
||||
'access_information' => 'setAccessInformation',
|
||||
'last_commit' => 'setLastCommit',
|
||||
'build_config' => 'setBuildConfig',
|
||||
'ssh_public_key' => 'setSshPublicKey',
|
||||
'id' => 'setId',
|
||||
'title' => 'setTitle',
|
||||
'reference' => 'setReference',
|
||||
'branch' => 'setBranch',
|
||||
'ssh_private_key' => 'setSshPrivateKey',
|
||||
'type' => 'setType',
|
||||
'access_information' => 'setAccessInformation',
|
||||
'last_commit' => 'setLastCommit',
|
||||
'build_config' => 'setBuildConfig',
|
||||
'ssh_public_key' => 'setSshPublicKey',
|
||||
'allow_public_status' => 'setAllowPublicStatus',
|
||||
'archived' => 'setArchived',
|
||||
'group_id' => 'setGroupId',
|
||||
|
||||
'archived' => 'setArchived',
|
||||
'group_id' => 'setGroupId',
|
||||
// Foreign key setters:
|
||||
'Group' => 'setGroup',
|
||||
);
|
||||
'Group' => 'setGroup',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
'id' => array(
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'title' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'title' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
],
|
||||
'reference' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'reference' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'branch' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
],
|
||||
'branch' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'default' => 'master',
|
||||
),
|
||||
'ssh_private_key' => array(
|
||||
'type' => 'text',
|
||||
],
|
||||
'ssh_private_key' => [
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'type' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'default' => null,
|
||||
),
|
||||
'type' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'default' => null,
|
||||
),
|
||||
'access_information' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
],
|
||||
'access_information' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'last_commit' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
],
|
||||
'last_commit' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'build_config' => array(
|
||||
'type' => 'text',
|
||||
'default' => null,
|
||||
],
|
||||
'build_config' => [
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'ssh_public_key' => array(
|
||||
'type' => 'text',
|
||||
'default' => null,
|
||||
],
|
||||
'ssh_public_key' => [
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'allow_public_status' => array(
|
||||
'type' => 'int',
|
||||
'default' => null,
|
||||
],
|
||||
'allow_public_status' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
),
|
||||
'archived' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => 1,
|
||||
],
|
||||
'archived' => [
|
||||
'type' => 'tinyint',
|
||||
'length' => 1,
|
||||
'default' => null,
|
||||
),
|
||||
'group_id' => array(
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
],
|
||||
'group_id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'default' => 1,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
'idx_project_title' => array('columns' => 'title'),
|
||||
'group_id' => array('columns' => 'group_id'),
|
||||
);
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'idx_project_title' => ['columns' => 'title'],
|
||||
'group_id' => ['columns' => 'group_id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = array(
|
||||
'project_ibfk_1' => array(
|
||||
'local_col' => 'group_id',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => '',
|
||||
'table' => 'project_group',
|
||||
'col' => 'id'
|
||||
),
|
||||
);
|
||||
public $foreignKeys = [
|
||||
'project_ibfk_1' => [
|
||||
'local_col' => 'group_id',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => '',
|
||||
'table' => 'project_group',
|
||||
'col' => 'id'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
|
|
|
@ -32,63 +32,60 @@ class ProjectGroupBase extends Model
|
|||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
'id' => null,
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = array(
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'id' => 'getId',
|
||||
'title' => 'getTitle',
|
||||
|
||||
// Foreign key getters:
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = array(
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'id' => 'setId',
|
||||
'title' => 'setTitle',
|
||||
|
||||
// Foreign key setters:
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
'id' => array(
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'title' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'default' => null,
|
||||
),
|
||||
'title' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'default' => null,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
);
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
public $foreignKeys = [];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
|
|
|
@ -32,89 +32,86 @@ class UserBase extends Model
|
|||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
'id' => null,
|
||||
'email' => null,
|
||||
'hash' => null,
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'email' => null,
|
||||
'hash' => null,
|
||||
'is_admin' => null,
|
||||
'name' => null,
|
||||
);
|
||||
'name' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = array(
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'email' => 'getEmail',
|
||||
'hash' => 'getHash',
|
||||
'id' => 'getId',
|
||||
'email' => 'getEmail',
|
||||
'hash' => 'getHash',
|
||||
'is_admin' => 'getIsAdmin',
|
||||
'name' => 'getName',
|
||||
|
||||
'name' => 'getName',
|
||||
// Foreign key getters:
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = array(
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'email' => 'setEmail',
|
||||
'hash' => 'setHash',
|
||||
'id' => 'setId',
|
||||
'email' => 'setEmail',
|
||||
'hash' => 'setHash',
|
||||
'is_admin' => 'setIsAdmin',
|
||||
'name' => 'setName',
|
||||
|
||||
'name' => 'setName',
|
||||
// Foreign key setters:
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
'id' => array(
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'email' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'email' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
],
|
||||
'hash' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'hash' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'is_admin' => array(
|
||||
'type' => 'int',
|
||||
],
|
||||
'is_admin' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
),
|
||||
'name' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
],
|
||||
'name' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
'idx_email' => array('unique' => true, 'columns' => 'email'),
|
||||
'email' => array('unique' => true, 'columns' => 'email'),
|
||||
'name' => array('columns' => 'name'),
|
||||
);
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'idx_email' => ['unique' => true, 'columns' => 'email'],
|
||||
'email' => ['unique' => true, 'columns' => 'email'],
|
||||
'name' => ['columns' => 'name'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
public $foreignKeys = [];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,18 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Test\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
|
||||
class BadModel extends Model
|
||||
{
|
||||
protected $_tableName = 'bad_table';
|
||||
protected $_tableName = 'bad_table';
|
||||
|
||||
public $columns = array(
|
||||
'id' => array('type' => 'catfish'),
|
||||
);
|
||||
public $columns = [
|
||||
'id' => ['type' => 'catfish'],
|
||||
];
|
||||
|
||||
public $indexes = array(
|
||||
);
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
public $indexes = [];
|
||||
public $foreignKeys = [];
|
||||
}
|
|
@ -1,24 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Test\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
|
||||
class Dos extends Model
|
||||
{
|
||||
protected $_tableName = 'dos';
|
||||
protected $_tableName = 'dos';
|
||||
|
||||
public $columns = array(
|
||||
'id' => array('type' => 'int', 'primary_key' => true, 'auto_increment' => false),
|
||||
'field_varchar' => array('type' => 'varchar', 'length' => '250', 'default' => 'Hello World'),
|
||||
'field_datetime'=> array('type' => 'datetime'),
|
||||
'field_int' => array('type' => 'int'),
|
||||
);
|
||||
public $columns = [
|
||||
'id' => ['type' => 'int', 'primary_key' => true, 'auto_increment' => false],
|
||||
'field_varchar' => ['type' => 'varchar', 'length' => '250', 'default' => 'Hello World'],
|
||||
'field_datetime' => ['type' => 'datetime'],
|
||||
'field_int' => ['type' => 'int'],
|
||||
];
|
||||
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
'idx_test_1' => array('unique' => true, 'columns' => 'field_int'),
|
||||
'idx_test_2' => array('columns' => 'field_datetime'),
|
||||
);
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'idx_test_1' => ['unique' => true, 'columns' => 'field_int'],
|
||||
'idx_test_2' => ['columns' => 'field_datetime'],
|
||||
];
|
||||
public $foreignKeys = [];
|
||||
}
|
|
@ -1,27 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Test\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
|
||||
class Tres extends Model
|
||||
{
|
||||
protected $_tableName = 'tres';
|
||||
protected $_tableName = 'tres';
|
||||
|
||||
public $columns = array(
|
||||
'id' => array('type' => 'int'),
|
||||
'field_varchar' => array('type' => 'varchar', 'length' => '250'),
|
||||
'field_date' => array('type' => 'date'),
|
||||
'field_datetime'=> array('type' => 'datetime'),
|
||||
'field_int' => array('type' => 'int'),
|
||||
'field_int_2' => array('type' => 'int'),
|
||||
);
|
||||
public $columns = [
|
||||
'id' => ['type' => 'int'],
|
||||
'field_varchar' => ['type' => 'varchar', 'length' => '250'],
|
||||
'field_date' => ['type' => 'date'],
|
||||
'field_datetime' => ['type' => 'datetime'],
|
||||
'field_int' => ['type' => 'int'],
|
||||
'field_int_2' => ['type' => 'int'],
|
||||
];
|
||||
|
||||
public $indexes = array(
|
||||
'fk_tres_uno' => array('columns' => 'field_int'),
|
||||
'fk_tres_dos' => array('columns' => 'field_int_2'),
|
||||
);
|
||||
public $foreignKeys = array(
|
||||
'fk_tres_uno' => array('local_col' => 'field_int', 'table' => 'uno', 'col' => 'id'),
|
||||
'fk_tres_dos' => array('local_col' => 'field_int_2', 'update' => 'NO ACTION', 'delete' => 'CASCADE', 'table' => 'dos', 'col' => 'id'),
|
||||
);
|
||||
public $indexes = [
|
||||
'fk_tres_uno' => ['columns' => 'field_int'],
|
||||
'fk_tres_dos' => ['columns' => 'field_int_2'],
|
||||
];
|
||||
|
||||
public $foreignKeys = [
|
||||
'fk_tres_uno' => ['local_col' => 'field_int', 'table' => 'uno', 'col' => 'id'],
|
||||
'fk_tres_dos' => [
|
||||
'local_col' => 'field_int_2',
|
||||
'update' => 'NO ACTION',
|
||||
'delete' => 'CASCADE',
|
||||
'table' => 'dos',
|
||||
'col' => 'id'
|
||||
],
|
||||
];
|
||||
}
|
|
@ -1,28 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Test\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
|
||||
class Uno extends Model
|
||||
{
|
||||
protected $_tableName = 'uno';
|
||||
protected $_tableName = 'uno';
|
||||
|
||||
public $columns = array(
|
||||
'id' => array('type' => 'int', 'primary_key' => true, 'auto_increment' => true),
|
||||
'field_varchar' => array('type' => 'varchar', 'length' => '250'),
|
||||
'field_text' => array('type' => 'text'),
|
||||
'field_ltext' => array('type' => 'longtext'),
|
||||
'field_mtext' => array('type' => 'mediumtext'),
|
||||
'field_date' => array('type' => 'date'),
|
||||
'field_datetime'=> array('type' => 'datetime'),
|
||||
'field_int' => array('type' => 'int'),
|
||||
'field_tinyint' => array('type' => 'tinyint', 'length' => '1'),
|
||||
'field_float' => array('type' => 'float'),
|
||||
'field_double' => array('type' => 'double', 'length' => '15,2'),
|
||||
);
|
||||
public $columns = [
|
||||
'id' => ['type' => 'int', 'primary_key' => true, 'auto_increment' => true],
|
||||
'field_varchar' => ['type' => 'varchar', 'length' => '250'],
|
||||
'field_text' => ['type' => 'text'],
|
||||
'field_ltext' => ['type' => 'longtext'],
|
||||
'field_mtext' => ['type' => 'mediumtext'],
|
||||
'field_date' => ['type' => 'date'],
|
||||
'field_datetime' => ['type' => 'datetime'],
|
||||
'field_int' => ['type' => 'int'],
|
||||
'field_tinyint' => ['type' => 'tinyint', 'length' => '1'],
|
||||
'field_float' => ['type' => 'float'],
|
||||
'field_double' => ['type' => 'double', 'length' => '15,2'],
|
||||
];
|
||||
|
||||
public $indexes = array(
|
||||
);
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
public $indexes = [];
|
||||
public $foreignKeys = [];
|
||||
}
|
|
@ -1,24 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Update\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
|
||||
class Dos extends Model
|
||||
{
|
||||
protected $_tableName = 'dos';
|
||||
protected $_tableName = 'dos';
|
||||
|
||||
public $columns = array(
|
||||
'id' => array('type' => 'int', 'primary_key' => true, 'auto_increment' => true),
|
||||
'field_varchar' => array('type' => 'varchar', 'length' => '250', 'default' => 'Hello World'),
|
||||
'field_datetime'=> array('type' => 'datetime'),
|
||||
'field_int' => array('type' => 'int'),
|
||||
);
|
||||
public $columns = [
|
||||
'id' => ['type' => 'int', 'primary_key' => true, 'auto_increment' => true],
|
||||
'field_varchar' => ['type' => 'varchar', 'length' => '250', 'default' => 'Hello World'],
|
||||
'field_datetime' => ['type' => 'datetime'],
|
||||
'field_int' => ['type' => 'int'],
|
||||
];
|
||||
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
'idx_test_1' => array('unique' => false, 'columns' => 'field_int'),
|
||||
'idx_test_2' => array('columns' => 'field_datetime'),
|
||||
);
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'idx_test_1' => ['unique' => false, 'columns' => 'field_int'],
|
||||
'idx_test_2' => ['columns' => 'field_datetime'],
|
||||
];
|
||||
public $foreignKeys = [];
|
||||
}
|
|
@ -1,32 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Update\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
|
||||
class Tres extends Model
|
||||
{
|
||||
protected $_tableName = 'tres';
|
||||
protected $_tableName = 'tres';
|
||||
|
||||
public $columns = array(
|
||||
'key_col' => array('type' => 'int', 'primary_key' => true, 'auto_increment' => true),
|
||||
'id' => array('type' => 'int'),
|
||||
'field_varchar' => array('type' => 'varchar', 'length' => '250', 'default' => 'Hello World'),
|
||||
'field_datetime'=> array('type' => 'datetime'),
|
||||
'field_int' => array('type' => 'int'),
|
||||
'field_int_2' => array('type' => 'int'),
|
||||
'field_dt' => array('type' => 'date', 'rename' => 'field_date'),
|
||||
'field_float_1' => array('type' => 'float', 'default' => '1'),
|
||||
'field_varchar_2' => array('type' => 'varchar', 'length' => '10', 'default' => 'Hello'),
|
||||
'dosid' => array('type' => 'int'),
|
||||
);
|
||||
public $columns = [
|
||||
'key_col' => ['type' => 'int', 'primary_key' => true, 'auto_increment' => true],
|
||||
'id' => ['type' => 'int'],
|
||||
'field_varchar' => ['type' => 'varchar', 'length' => '250', 'default' => 'Hello World'],
|
||||
'field_datetime' => ['type' => 'datetime'],
|
||||
'field_int' => ['type' => 'int'],
|
||||
'field_int_2' => ['type' => 'int'],
|
||||
'field_dt' => ['type' => 'date', 'rename' => 'field_date'],
|
||||
'field_float_1' => ['type' => 'float', 'default' => '1'],
|
||||
'field_varchar_2' => ['type' => 'varchar', 'length' => '10', 'default' => 'Hello'],
|
||||
'dosid' => ['type' => 'int'],
|
||||
];
|
||||
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'key_col'),
|
||||
'fk_tres_dos' => array('columns' => 'field_int_2'),
|
||||
'fk_tres_dos_2' => array('columns' => 'dosid'),
|
||||
);
|
||||
public $foreignKeys = array(
|
||||
'fk_tres_dos' => array('local_col' => 'field_int_2', 'update' => 'CASCADE', 'delete' => 'CASCADE', 'table' => 'dos', 'col' => 'id'),
|
||||
'fk_tres_dos_2' => array('local_col' => 'dosid', 'update' => 'CASCADE', 'delete' => 'CASCADE', 'table' => 'dos', 'col' => 'id'),
|
||||
);
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'key_col'],
|
||||
'fk_tres_dos' => ['columns' => 'field_int_2'],
|
||||
'fk_tres_dos_2' => ['columns' => 'dosid'],
|
||||
];
|
||||
|
||||
public $foreignKeys = [
|
||||
'fk_tres_dos' => [
|
||||
'local_col' => 'field_int_2',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => 'CASCADE',
|
||||
'table' => 'dos',
|
||||
'col' => 'id'
|
||||
],
|
||||
'fk_tres_dos_2' => [
|
||||
'local_col' => 'dosid',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => 'CASCADE',
|
||||
'table' => 'dos',
|
||||
'col' => 'id'
|
||||
],
|
||||
];
|
||||
}
|
|
@ -1,27 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Update\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
|
||||
class Uno extends Model
|
||||
{
|
||||
protected $_tableName = 'uno';
|
||||
protected $_tableName = 'uno';
|
||||
|
||||
public $columns = array(
|
||||
'id' => array('type' => 'int', 'primary_key' => true),
|
||||
'field_varchar' => array('type' => 'varchar', 'length' => '250'),
|
||||
'field_text' => array('type' => 'text'),
|
||||
'field_ltext' => array('type' => 'longtext'),
|
||||
'field_mtext' => array('type' => 'mediumtext'),
|
||||
'field_datetime'=> array('type' => 'datetime'),
|
||||
'field_int' => array('type' => 'int'),
|
||||
'field_tinyint' => array('type' => 'tinyint', 'length' => '1'),
|
||||
'field_float' => array('type' => 'float'),
|
||||
'field_double' => array('type' => 'double', 'length' => '15,2'),
|
||||
);
|
||||
public $columns = [
|
||||
'id' => ['type' => 'int', 'primary_key' => true],
|
||||
'field_varchar' => ['type' => 'varchar', 'length' => '250'],
|
||||
'field_text' => ['type' => 'text'],
|
||||
'field_ltext' => ['type' => 'longtext'],
|
||||
'field_mtext' => ['type' => 'mediumtext'],
|
||||
'field_datetime' => ['type' => 'datetime'],
|
||||
'field_int' => ['type' => 'int'],
|
||||
'field_tinyint' => ['type' => 'tinyint', 'length' => '1'],
|
||||
'field_float' => ['type' => 'float'],
|
||||
'field_double' => ['type' => 'double', 'length' => '15,2'],
|
||||
];
|
||||
|
||||
public $indexes = array(
|
||||
);
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
public $indexes = [];
|
||||
public $foreignKeys = [];
|
||||
}
|
|
@ -35,18 +35,16 @@ class CreateAdminCommandTest extends \PHPUnit_Framework_TestCase
|
|||
parent::setup();
|
||||
|
||||
$this->command = $this->getMockBuilder('PHPCI\\Command\\CreateAdminCommand')
|
||||
->setConstructorArgs(array($this->getMock('PHPCI\\Store\\UserStore')))
|
||||
->setMethods(array('reloadConfig'))
|
||||
->getMock()
|
||||
;
|
||||
->setConstructorArgs([$this->getMock('PHPCI\\Store\\UserStore')])
|
||||
->setMethods(['reloadConfig'])
|
||||
->getMock();
|
||||
|
||||
$this->dialog = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\DialogHelper')
|
||||
->setMethods(array(
|
||||
->setMethods([
|
||||
'ask',
|
||||
'askAndValidate',
|
||||
'askHiddenResponse',
|
||||
))
|
||||
->getMock()
|
||||
])->getMock()
|
||||
;
|
||||
|
||||
$this->application = new Application();
|
||||
|
|
|
@ -33,24 +33,24 @@ class CreateBuildCommandTest extends \PHPUnit_Framework_TestCase
|
|||
$projectStoreMock = $this->getMockBuilder('PHPCI\\Store\\ProjectStore')
|
||||
->getMock();
|
||||
$projectStoreMock->method('getById')
|
||||
->will($this->returnValueMap(array(
|
||||
array(1, 'read', $projectMock),
|
||||
array(2, 'read', null),
|
||||
)));
|
||||
->will($this->returnValueMap([
|
||||
[1, 'read', $projectMock],
|
||||
[2, 'read', null],
|
||||
]));
|
||||
|
||||
$buildServiceMock = $this->getMockBuilder('PHPCI\\Service\\BuildService')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$buildServiceMock->method('createBuild')
|
||||
->withConsecutive(
|
||||
array($projectMock, null, null, null, null, null),
|
||||
array($projectMock, '92c8c6e', null, null, null, null),
|
||||
array($projectMock, null, 'master', null, null, null)
|
||||
[$projectMock, null, null, null, null, null],
|
||||
[$projectMock, '92c8c6e', null, null, null, null],
|
||||
[$projectMock, null, 'master', null, null, null]
|
||||
);
|
||||
|
||||
$this->command = $this->getMockBuilder('PHPCI\\Command\\CreateBuildCommand')
|
||||
->setConstructorArgs(array($projectStoreMock, $buildServiceMock))
|
||||
->setMethods(array('reloadConfig'))
|
||||
->setConstructorArgs([$projectStoreMock, $buildServiceMock])
|
||||
->setMethods(['reloadConfig'])
|
||||
->getMock();
|
||||
|
||||
$this->application = new Application();
|
||||
|
@ -70,9 +70,9 @@ class CreateBuildCommandTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$commandTester = $this->getCommandTester();
|
||||
|
||||
$commandTester->execute(array('projectId' => 1));
|
||||
$commandTester->execute(array('projectId' => 1, '--commit' => '92c8c6e'));
|
||||
$commandTester->execute(array('projectId' => 1, '--branch' => 'master'));
|
||||
$commandTester->execute(['projectId' => 1]);
|
||||
$commandTester->execute(['projectId' => 1, '--commit' => '92c8c6e']);
|
||||
$commandTester->execute(['projectId' => 1, '--branch' => 'master']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,6 +81,6 @@ class CreateBuildCommandTest extends \PHPUnit_Framework_TestCase
|
|||
public function testExecuteWithUnknownProjectId()
|
||||
{
|
||||
$commandTester = $this->getCommandTester();
|
||||
$commandTester->execute(array('projectId' => 2));
|
||||
$commandTester->execute(['projectId' => 2]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,14 +35,13 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
// We check that there's no interaction with user.
|
||||
$dialog = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\DialogHelper')
|
||||
->setMethods(array(
|
||||
'ask',
|
||||
'askConfirmation',
|
||||
'askAndValidate',
|
||||
'askHiddenResponse',
|
||||
'askHiddenResponseAndValidate',
|
||||
))
|
||||
->getMock();
|
||||
->setMethods([
|
||||
'ask',
|
||||
'askConfirmation',
|
||||
'askAndValidate',
|
||||
'askHiddenResponse',
|
||||
'askHiddenResponseAndValidate',
|
||||
])->getMock();
|
||||
|
||||
return $dialog;
|
||||
}
|
||||
|
@ -55,7 +54,7 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
|
|||
// Current command, we need to mock all method that interact with
|
||||
// Database & File system.
|
||||
$command = $this->getMockBuilder('PHPCI\\Command\\InstallCommand')
|
||||
->setMethods(array(
|
||||
->setMethods([
|
||||
'reloadConfig',
|
||||
'verifyNotInstalled',
|
||||
'verifyDatabaseDetails',
|
||||
|
@ -63,8 +62,7 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
|
|||
'createAdminUser',
|
||||
'writeConfigFile',
|
||||
'checkRequirements',
|
||||
))
|
||||
->getMock();
|
||||
])->getMock();
|
||||
|
||||
$self = $this;
|
||||
|
||||
|
@ -98,17 +96,17 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function getConfig($exclude = null)
|
||||
{
|
||||
$config = array(
|
||||
'--db-host' => 'localhost',
|
||||
'--db-name' => 'phpci1',
|
||||
'--db-user' => 'phpci2',
|
||||
'--db-pass' => 'phpci3',
|
||||
'--admin-mail' => 'phpci@phpci.test',
|
||||
'--admin-name' => 'phpci4',
|
||||
'--admin-pass' => 'phpci5',
|
||||
'--url' => 'http://test.phpci.org',
|
||||
$config = [
|
||||
'--db-host' => 'localhost',
|
||||
'--db-name' => 'phpci1',
|
||||
'--db-user' => 'phpci2',
|
||||
'--db-pass' => 'phpci3',
|
||||
'--admin-mail' => 'phpci@phpci.test',
|
||||
'--admin-name' => 'phpci4',
|
||||
'--admin-pass' => 'phpci5',
|
||||
'--url' => 'http://test.phpci.org',
|
||||
'--queue-disabled' => null,
|
||||
);
|
||||
];
|
||||
|
||||
if (!is_null($exclude)) {
|
||||
unset($config[$exclude]);
|
||||
|
|
|
@ -37,28 +37,28 @@ class CommandExecutorTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testGetLastOutput_ReturnsOutputOfCommand()
|
||||
{
|
||||
$this->testedExecutor->executeCommand(array('echo "%s"', 'Hello World'));
|
||||
$this->testedExecutor->executeCommand(['echo "%s"', 'Hello World']);
|
||||
$output = $this->testedExecutor->getLastOutput();
|
||||
$this->assertEquals("Hello World", $output);
|
||||
}
|
||||
|
||||
public function testGetLastOutput_ForgetsPreviousCommandOutput()
|
||||
{
|
||||
$this->testedExecutor->executeCommand(array('echo "%s"', 'Hello World'));
|
||||
$this->testedExecutor->executeCommand(array('echo "%s"', 'Hello Tester'));
|
||||
$this->testedExecutor->executeCommand(['echo "%s"', 'Hello World']);
|
||||
$this->testedExecutor->executeCommand(['echo "%s"', 'Hello Tester']);
|
||||
$output = $this->testedExecutor->getLastOutput();
|
||||
$this->assertEquals("Hello Tester", $output);
|
||||
}
|
||||
|
||||
public function testExecuteCommand_ReturnsTrueForValidCommands()
|
||||
{
|
||||
$returnValue = $this->testedExecutor->executeCommand(array('echo "%s"', 'Hello World'));
|
||||
$returnValue = $this->testedExecutor->executeCommand(['echo "%s"', 'Hello World']);
|
||||
$this->assertTrue($returnValue);
|
||||
}
|
||||
|
||||
public function testExecuteCommand_ReturnsFalseForInvalidCommands()
|
||||
{
|
||||
$returnValue = $this->testedExecutor->executeCommand(array('eerfdcvcho "%s" > /dev/null 2>&1', 'Hello World'));
|
||||
$returnValue = $this->testedExecutor->executeCommand(['eerfdcvcho "%s" > /dev/null 2>&1', 'Hello World']);
|
||||
$this->assertFalse($returnValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,16 +27,16 @@ class MailerFactoryTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testExecute_TestGetMailConfig()
|
||||
{
|
||||
$config = array(
|
||||
'smtp_address' => 'mail.example.com',
|
||||
'smtp_port' => 225,
|
||||
'smtp_encryption' => true,
|
||||
'smtp_username' => 'example.user',
|
||||
'smtp_password' => 'examplepassword',
|
||||
$config = [
|
||||
'smtp_address' => 'mail.example.com',
|
||||
'smtp_port' => 225,
|
||||
'smtp_encryption' => true,
|
||||
'smtp_username' => 'example.user',
|
||||
'smtp_password' => 'examplepassword',
|
||||
'default_mailto_address' => 'phpci@example.com',
|
||||
);
|
||||
];
|
||||
|
||||
$factory = new MailerFactory(array('email_settings' => $config));
|
||||
$factory = new MailerFactory(['email_settings' => $config]);
|
||||
|
||||
$this->assertEquals($config['smtp_address'], $factory->getMailConfig('smtp_address'));
|
||||
$this->assertEquals($config['smtp_port'], $factory->getMailConfig('smtp_port'));
|
||||
|
@ -51,16 +51,16 @@ class MailerFactoryTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testExecute_TestMailer()
|
||||
{
|
||||
$config = array(
|
||||
'smtp_address' => 'mail.example.com',
|
||||
'smtp_port' => 225,
|
||||
'smtp_encryption' => true,
|
||||
'smtp_username' => 'example.user',
|
||||
'smtp_password' => 'examplepassword',
|
||||
$config = [
|
||||
'smtp_address' => 'mail.example.com',
|
||||
'smtp_port' => 225,
|
||||
'smtp_encryption' => true,
|
||||
'smtp_username' => 'example.user',
|
||||
'smtp_password' => 'examplepassword',
|
||||
'default_mailto_address' => 'phpci@example.com',
|
||||
);
|
||||
];
|
||||
|
||||
$factory = new MailerFactory(array('email_settings' => $config));
|
||||
$factory = new MailerFactory(['email_settings' => $config]);
|
||||
$mailer = $factory->getSwiftMailerFromConfig();
|
||||
|
||||
$this->assertEquals($config['smtp_address'], $mailer->getTransport()->getHost());
|
||||
|
|
|
@ -31,11 +31,11 @@ class LoggerConfigTest extends \PHPUnit_Framework_TestCase
|
|||
public function testGetFor_AttachesAlwaysPresentHandlers()
|
||||
{
|
||||
$expectedHandler = new \Monolog\Handler\NullHandler();
|
||||
$config = new LoggerConfig(array(
|
||||
$config = new LoggerConfig([
|
||||
LoggerConfig::KEY_ALWAYS_LOADED => function() use ($expectedHandler) {
|
||||
return array($expectedHandler);
|
||||
return [$expectedHandler];
|
||||
}
|
||||
));
|
||||
]);
|
||||
|
||||
/** @var \Monolog\Logger $logger */
|
||||
$logger = $config->getFor("something");
|
||||
|
@ -47,11 +47,11 @@ class LoggerConfigTest extends \PHPUnit_Framework_TestCase
|
|||
public function testGetFor_AttachesSpecificHandlers()
|
||||
{
|
||||
$expectedHandler = new \Monolog\Handler\NullHandler();
|
||||
$config = new LoggerConfig(array(
|
||||
$config = new LoggerConfig([
|
||||
"Specific" => function() use ($expectedHandler) {
|
||||
return array($expectedHandler);
|
||||
return [$expectedHandler];
|
||||
}
|
||||
));
|
||||
]);
|
||||
|
||||
/** @var \Monolog\Logger $logger */
|
||||
$logger = $config->getFor("Specific");
|
||||
|
@ -65,14 +65,14 @@ class LoggerConfigTest extends \PHPUnit_Framework_TestCase
|
|||
$expectedHandler = new \Monolog\Handler\NullHandler();
|
||||
$alternativeHandler = new \Monolog\Handler\NullHandler();
|
||||
|
||||
$config = new LoggerConfig(array(
|
||||
$config = new LoggerConfig([
|
||||
"Specific" => function() use ($expectedHandler) {
|
||||
return array($expectedHandler);
|
||||
return [$expectedHandler];
|
||||
},
|
||||
"Other" => function() use ($alternativeHandler) {
|
||||
return array($alternativeHandler);
|
||||
return [$alternativeHandler];
|
||||
}
|
||||
));
|
||||
]);
|
||||
|
||||
/** @var \Monolog\Logger $logger */
|
||||
$logger = $config->getFor("Specific");
|
||||
|
|
|
@ -70,10 +70,10 @@ class BuildTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testExecute_TestBuildExtra()
|
||||
{
|
||||
$info = array(
|
||||
$info = [
|
||||
'item1' => 'Item One',
|
||||
'item2' => 2,
|
||||
);
|
||||
];
|
||||
|
||||
$build = new Build();
|
||||
$build->setExtra(json_encode($info));
|
||||
|
|
|
@ -95,10 +95,10 @@ class ProjectTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testExecute_TestProjectAccessInformation()
|
||||
{
|
||||
$info = array(
|
||||
$info = [
|
||||
'item1' => 'Item One',
|
||||
'item2' => 2,
|
||||
);
|
||||
];
|
||||
|
||||
$project = new Project();
|
||||
$project->setAccessInformation($info);
|
||||
|
|
|
@ -116,15 +116,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
$this->mockCiBuilder->expects($this->any())
|
||||
->method('getSystemConfig')
|
||||
->with('phpci')
|
||||
->will(
|
||||
$this->returnValue(
|
||||
array(
|
||||
'email_settings' => array(
|
||||
'from_address' => "test-from-address@example.com"
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
->will($this->returnValue(['email_settings' => ['from_address' => "test-from-address@example.com"]]));
|
||||
}
|
||||
|
||||
protected function loadEmailPluginWithOptions($arrOptions = [], $buildStatus = null, $mailDelivered = true)
|
||||
|
@ -144,12 +136,12 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->testedEmailPlugin = $this->getMock(
|
||||
'\PHPCI\Plugin\Email',
|
||||
array('sendEmail'),
|
||||
array(
|
||||
['sendEmail'],
|
||||
[
|
||||
$this->mockCiBuilder,
|
||||
$this->mockBuild,
|
||||
$arrOptions
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$this->testedEmailPlugin->expects($this->any())
|
||||
|
@ -184,12 +176,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testBuildsBasicEmails()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'addresses' => array('test-receiver@example.com')
|
||||
),
|
||||
Build::STATUS_SUCCESS
|
||||
);
|
||||
$this->loadEmailPluginWithOptions(['addresses' => ['test-receiver@example.com']], Build::STATUS_SUCCESS);
|
||||
|
||||
$this->testedEmailPlugin->execute();
|
||||
|
||||
|
@ -201,12 +188,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testBuildsDefaultEmails()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'default_mailto_address' => 'default-mailto-address@example.com'
|
||||
),
|
||||
Build::STATUS_SUCCESS
|
||||
);
|
||||
$this->loadEmailPluginWithOptions(['default_mailto_address' => 'default-mailto-address@example.com'], Build::STATUS_SUCCESS);
|
||||
|
||||
$this->testedEmailPlugin->execute();
|
||||
|
||||
|
@ -218,11 +200,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testExecute_UniqueRecipientsFromWithCommitter()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'addresses' => array('test-receiver@example.com', 'test-receiver2@example.com')
|
||||
)
|
||||
);
|
||||
$this->loadEmailPluginWithOptions(['addresses' => ['test-receiver@example.com', 'test-receiver2@example.com']]);
|
||||
|
||||
$returnValue = $this->testedEmailPlugin->execute();
|
||||
$this->assertTrue($returnValue);
|
||||
|
@ -238,12 +216,10 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testExecute_UniqueRecipientsWithCommitter()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'committer' => true,
|
||||
'addresses' => array('test-receiver@example.com', 'committer@test.com')
|
||||
)
|
||||
);
|
||||
$this->loadEmailPluginWithOptions([
|
||||
'committer' => true,
|
||||
'addresses' => ['test-receiver@example.com', 'committer@test.com']
|
||||
]);
|
||||
|
||||
$returnValue = $this->testedEmailPlugin->execute();
|
||||
$this->assertTrue($returnValue);
|
||||
|
@ -258,25 +234,25 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
public function testCcDefaultEmails()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
[
|
||||
'default_mailto_address' => 'default-mailto-address@example.com',
|
||||
'cc' => array(
|
||||
'cc' => [
|
||||
'cc-email-1@example.com',
|
||||
'cc-email-2@example.com',
|
||||
'cc-email-3@example.com',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
Build::STATUS_SUCCESS
|
||||
);
|
||||
|
||||
$this->testedEmailPlugin->execute();
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
[
|
||||
'cc-email-1@example.com',
|
||||
'cc-email-2@example.com',
|
||||
'cc-email-3@example.com',
|
||||
),
|
||||
],
|
||||
$this->message['cc']
|
||||
);
|
||||
}
|
||||
|
@ -287,9 +263,9 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
public function testBuildsCommitterEmails()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
[
|
||||
'committer' => true
|
||||
),
|
||||
],
|
||||
Build::STATUS_SUCCESS
|
||||
);
|
||||
|
||||
|
@ -304,9 +280,9 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
public function testMailSuccessfulBuildHaveProjectName()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'addresses' => array('test-receiver@example.com')
|
||||
),
|
||||
[
|
||||
'addresses' => ['test-receiver@example.com']
|
||||
],
|
||||
Build::STATUS_SUCCESS
|
||||
);
|
||||
|
||||
|
@ -322,9 +298,9 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
public function testMailFailingBuildHaveProjectName()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'addresses' => array('test-receiver@example.com')
|
||||
),
|
||||
[
|
||||
'addresses' => ['test-receiver@example.com']
|
||||
],
|
||||
Build::STATUS_FAILED
|
||||
);
|
||||
|
||||
|
@ -340,9 +316,9 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
public function testMailSuccessfulBuildHaveStatus()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'addresses' => array('test-receiver@example.com')
|
||||
),
|
||||
[
|
||||
'addresses' => ['test-receiver@example.com']
|
||||
],
|
||||
Build::STATUS_SUCCESS
|
||||
);
|
||||
|
||||
|
@ -358,9 +334,9 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
public function testMailFailingBuildHaveStatus()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'addresses' => array('test-receiver@example.com')
|
||||
),
|
||||
[
|
||||
'addresses' => ['test-receiver@example.com']
|
||||
],
|
||||
Build::STATUS_FAILED
|
||||
);
|
||||
|
||||
|
@ -376,9 +352,9 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
public function testMailDeliverySuccess()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'addresses' => array('test-receiver@example.com')
|
||||
),
|
||||
[
|
||||
'addresses' => ['test-receiver@example.com']
|
||||
],
|
||||
Build::STATUS_FAILED,
|
||||
true
|
||||
);
|
||||
|
@ -394,9 +370,9 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
|||
public function testMailDeliveryFail()
|
||||
{
|
||||
$this->loadEmailPluginWithOptions(
|
||||
array(
|
||||
'addresses' => array('test-receiver@example.com')
|
||||
),
|
||||
[
|
||||
'addresses' => ['test-receiver@example.com']
|
||||
],
|
||||
Build::STATUS_FAILED,
|
||||
false
|
||||
);
|
||||
|
|
|
@ -61,7 +61,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
|
|||
protected function cleanSource()
|
||||
{
|
||||
if ($this->directory) {
|
||||
$filenames = array(
|
||||
$filenames = [
|
||||
'/build.phar',
|
||||
'/stub.php',
|
||||
'/views/index.phtml',
|
||||
|
@ -70,7 +70,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
|
|||
'/config',
|
||||
'/two.php',
|
||||
'/one.php',
|
||||
);
|
||||
];
|
||||
foreach ($filenames as $filename) {
|
||||
if (is_dir($this->directory . $filename)) {
|
||||
rmdir($this->directory . $filename);
|
||||
|
@ -104,7 +104,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
|
|||
$plugin->getPHPCI()->buildPath = 'foo';
|
||||
$this->assertEquals('foo', $plugin->getDirectory());
|
||||
|
||||
$plugin = $this->getPlugin(array('directory' => 'dirname'));
|
||||
$plugin = $this->getPlugin(['directory' => 'dirname']);
|
||||
$this->assertEquals('dirname', $plugin->getDirectory());
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
|
|||
$plugin = $this->getPlugin();
|
||||
$this->assertEquals('build.phar', $plugin->getFilename());
|
||||
|
||||
$plugin = $this->getPlugin(array('filename' => 'another.phar'));
|
||||
$plugin = $this->getPlugin(['filename' => 'another.phar']);
|
||||
$this->assertEquals('another.phar', $plugin->getFilename());
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
|
|||
$plugin = $this->getPlugin();
|
||||
$this->assertEquals('/\.php$/', $plugin->getRegExp());
|
||||
|
||||
$plugin = $this->getPlugin(array('regexp' => '/\.(php|phtml)$/'));
|
||||
$plugin = $this->getPlugin(['regexp' => '/\.(php|phtml)$/']);
|
||||
$this->assertEquals('/\.(php|phtml)$/', $plugin->getRegExp());
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
|
|||
$plugin = $this->getPlugin();
|
||||
$this->assertNull($plugin->getStub());
|
||||
|
||||
$plugin = $this->getPlugin(array('stub' => 'stub.php'));
|
||||
$plugin = $this->getPlugin(['stub' => 'stub.php']);
|
||||
$this->assertEquals('stub.php', $plugin->getStub());
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$this->checkReadonly();
|
||||
|
||||
$plugin = $this->getPlugin(array('regexp' => '/\.(php|phtml)$/'));
|
||||
$plugin = $this->getPlugin(['regexp' => '/\.(php|phtml)$/']);
|
||||
$path = $this->buildSource();
|
||||
$plugin->getPHPCI()->buildPath = $path;
|
||||
|
||||
|
@ -184,7 +184,7 @@ STUB;
|
|||
$path = $this->buildSource();
|
||||
file_put_contents($path . '/stub.php', $content);
|
||||
|
||||
$plugin = $this->getPlugin(array('stub' => 'stub.php'));
|
||||
$plugin = $this->getPlugin(['stub' => 'stub.php']);
|
||||
$plugin->getPHPCI()->buildPath = $path;
|
||||
|
||||
$this->assertTrue($plugin->execute());
|
||||
|
@ -200,7 +200,7 @@ STUB;
|
|||
|
||||
$directory = $this->buildTemp();
|
||||
|
||||
$plugin = $this->getPlugin(array('directory' => $directory));
|
||||
$plugin = $this->getPlugin(['directory' => $directory]);
|
||||
$plugin->getPHPCI()->buildPath = $this->buildSource();
|
||||
|
||||
$this->assertFalse($plugin->execute());
|
||||
|
|
|
@ -12,9 +12,9 @@ return function (PHPCI\Plugin\Util\Factory $factory) {
|
|||
$factory->registerResource(
|
||||
// This function will be called when the resource is needed.
|
||||
function() {
|
||||
return array(
|
||||
return [
|
||||
'bar' => "Hello",
|
||||
);
|
||||
];
|
||||
},
|
||||
"requiredArgument",
|
||||
null
|
||||
|
|
|
@ -130,12 +130,12 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
|
|||
$behatPluginOptions = [];
|
||||
$build = new \PHPCI\Model\Build();
|
||||
|
||||
$config = array(
|
||||
'stageOne' => array(
|
||||
$config = [
|
||||
'stageOne' => [
|
||||
'PhpUnit' => $phpUnitPluginOptions,
|
||||
'Behat' => $behatPluginOptions,
|
||||
)
|
||||
);
|
||||
'Behat' => $behatPluginOptions,
|
||||
]
|
||||
];
|
||||
|
||||
$pluginNamespace = 'PHPCI\\Plugin\\';
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
|||
public function testRegisterResourceThrowsExceptionIfLoaderIsntFunction()
|
||||
{
|
||||
$this->setExpectedException('InvalidArgumentException', '$loader is expected to be a function');
|
||||
$this->testedFactory->registerResource(array("dummy"), "TestName", "TestClass");
|
||||
$this->testedFactory->registerResource(["dummy"], "TestName", "TestClass");
|
||||
}
|
||||
|
||||
public function testBuildPluginWorksWithConstructorlessPlugins()
|
||||
|
@ -131,9 +131,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
|||
{
|
||||
$pluginClass = $this->getFakePluginClassName('ExamplePluginFull');
|
||||
|
||||
$expectedArgs = array(
|
||||
$expectedArgs = [
|
||||
'thing' => "stuff"
|
||||
);
|
||||
];
|
||||
|
||||
$this->registerBuildAndBuilder();
|
||||
|
||||
|
@ -167,7 +167,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
// The Example config file defines an array as the resource.
|
||||
$this->assertEquals(
|
||||
array("bar" => "Hello"),
|
||||
["bar" => "Hello"],
|
||||
$plugin->RequiredArgument
|
||||
);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class BuildServiceTest extends \PHPUnit_Framework_TestCase
|
|||
$project->setType('bitbucket');
|
||||
$project->setId(101);
|
||||
|
||||
$returnValue = $this->testedService->createBuild($project, null, null, null, null, array('item1' => 1001));
|
||||
$returnValue = $this->testedService->createBuild($project, null, null, null, null, ['item1' => 1001]);
|
||||
|
||||
$this->assertEquals(1001, $returnValue->getExtra('item1'));
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class BuildServiceTest extends \PHPUnit_Framework_TestCase
|
|||
$build->setFinished(new \DateTime());
|
||||
$build->setCommitMessage('test');
|
||||
$build->setCommitterEmail('test@example.com');
|
||||
$build->setExtra(json_encode(array('item1' => 1001)));
|
||||
$build->setExtra(json_encode(['item1' => 1001]));
|
||||
|
||||
$returnValue = $this->testedService->createDuplicateBuild($build);
|
||||
|
||||
|
|
Loading…
Reference in a new issue