First Local Commit - After Clean up.

Signed-off-by: Rick Hays <rhays@haysgang.com>
This commit is contained in:
2019-12-02 14:54:38 -06:00
commit 10412ab7f6
486 changed files with 123242 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php namespace Tests\Support\Models;
use CodeIgniter\Model;
class EntityModel extends Model
{
protected $table = 'job';
protected $returnType = '\Tests\Support\Models\SimpleEntity';
protected $useSoftDeletes = false;
protected $dateFormat = 'int';
protected $deletedField = 'deleted_at';
protected $allowedFields = [
'name',
'description',
'created_at',
];
}

View File

@@ -0,0 +1,79 @@
<?php namespace Tests\Support\Models;
use CodeIgniter\Model;
class EventModel extends Model
{
protected $table = 'user';
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $dateFormat = 'datetime';
protected $allowedFields = [
'name',
'email',
'country',
'deleted_at',
];
protected $beforeInsert = ['beforeInsertMethod'];
protected $afterInsert = ['afterInsertMethod'];
protected $beforeUpdate = ['beforeUpdateMethod'];
protected $afterUpdate = ['afterUpdateMethod'];
protected $afterFind = ['afterFindMethod'];
protected $afterDelete = ['afterDeleteMethod'];
// Holds stuff for testing events
protected $tokens = [];
protected function beforeInsertMethod(array $data)
{
$this->tokens[] = 'beforeInsert';
return $data;
}
protected function afterInsertMethod(array $data)
{
$this->tokens[] = 'afterInsert';
return $data;
}
protected function beforeUpdateMethod(array $data)
{
$this->tokens[] = 'beforeUpdate';
return $data;
}
protected function afterUpdateMethod(array $data)
{
$this->tokens[] = 'afterUpdate';
return $data;
}
protected function afterFindMethod(array $data)
{
$this->tokens[] = 'afterFind';
return $data;
}
protected function afterDeleteMethod(array $data)
{
$this->tokens[] = 'afterDelete';
return $data;
}
public function hasToken(string $token)
{
return in_array($token, $this->tokens);
}
}

View File

@@ -0,0 +1,23 @@
<?php namespace Tests\Support\Models;
use CodeIgniter\Model;
class JobModel extends Model
{
protected $table = 'job';
protected $returnType = 'object';
protected $useSoftDeletes = false;
protected $dateFormat = 'int';
protected $allowedFields = [
'name',
'description',
];
public $name = '';
public $description = '';
}

View File

@@ -0,0 +1,21 @@
<?php namespace Tests\Support\Models;
use CodeIgniter\Model;
class SecondaryModel extends Model
{
protected $table = 'secondary';
protected $primaryKey = 'id';
protected $returnType = 'object';
protected $useSoftDeletes = false;
protected $dateFormat = 'int';
protected $allowedFields = [
'key',
'value',
];
}

View File

@@ -0,0 +1,16 @@
<?php namespace Tests\Support\Models;
use CodeIgniter\Entity;
/**
* Class SimpleEntity
*
* Simple Entity-type class for testing creating and saving entities
* in the model so we can support Entity/Repository type patterns.
*
* @package Tests\Support\Models
*/
class SimpleEntity extends Entity
{
}

View File

@@ -0,0 +1,27 @@
<?php namespace Tests\Support\Models;
use CodeIgniter\Model;
class UserModel extends Model
{
protected $table = 'user';
protected $allowedFields = [
'name',
'email',
'country',
'deleted_at',
];
protected $returnType = 'object';
protected $useSoftDeletes = true;
protected $dateFormat = 'datetime';
public $name = '';
public $email = '';
public $country = '';
}

View File

@@ -0,0 +1,30 @@
<?php namespace Tests\Support\Models;
use CodeIgniter\Model;
class ValidErrorsModel extends Model
{
protected $table = 'job';
protected $returnType = 'object';
protected $useSoftDeletes = false;
protected $dateFormat = 'int';
protected $allowedFields = [
'name',
'description',
];
protected $validationRules = [
'name' => [
'required',
'min_length[10]',
'errors' => [
'min_length' => 'Minimum Length Error',
]
],
'token' => 'in_list[{id}]',
];
}

View File

@@ -0,0 +1,34 @@
<?php namespace Tests\Support\Models;
use CodeIgniter\Model;
class ValidModel extends Model
{
protected $table = 'job';
protected $returnType = 'object';
protected $useSoftDeletes = false;
protected $dateFormat = 'int';
protected $allowedFields = [
'name',
'description',
];
protected $validationRules = [
'name' => [
'required',
'min_length[3]',
],
'token' => 'in_list[{id}]',
];
protected $validationMessages = [
'name' => [
'required' => 'You forgot to name the baby.',
'min_length' => 'Too short, man!',
],
];
}