Updated DB Schema with current table structure. Signed-off-by: Rick Hays <rhays@haysgang.com>master
@ -1,5 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
class UnnamespacedClass |
|
||||
{ |
|
||||
} |
|
@ -1,8 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
use CodeIgniter\Test; |
|
||||
|
|
||||
class CIDatabaseTestCase extends Test\CIDatabaseTestCase |
|
||||
{ |
|
||||
|
|
||||
} |
|
@ -1,8 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
use CodeIgniter\Test; |
|
||||
|
|
||||
class CIUnitTestCase extends Test\CIUnitTestCase |
|
||||
{ |
|
||||
|
|
||||
} |
|
@ -1,198 +0,0 @@ |
|||||
<?php namespace Tests\Support\Cache\Handlers; |
|
||||
|
|
||||
use CodeIgniter\Cache\CacheInterface; |
|
||||
|
|
||||
class MockHandler implements CacheInterface |
|
||||
{ |
|
||||
/** |
|
||||
* Prefixed to all cache names. |
|
||||
* |
|
||||
* @var string |
|
||||
*/ |
|
||||
protected $prefix; |
|
||||
|
|
||||
/** |
|
||||
* Mock cache storage. |
|
||||
* |
|
||||
* @var array |
|
||||
*/ |
|
||||
protected $cache = []; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Takes care of any handler-specific setup that must be done. |
|
||||
*/ |
|
||||
public function initialize() |
|
||||
{ |
|
||||
// Not to see here... |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Attempts to fetch an item from the cache store. |
|
||||
* |
|
||||
* @param string $key Cache item name |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function get(string $key) |
|
||||
{ |
|
||||
$key = $this->prefix . $key; |
|
||||
|
|
||||
return array_key_exists($key, $this->cache) |
|
||||
? $this->cache[$key] |
|
||||
: null; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Saves an item to the cache store. |
|
||||
* |
|
||||
* The $raw parameter is only utilized by Mamcache in order to |
|
||||
* allow usage of increment() and decrement(). |
|
||||
* |
|
||||
* @param string $key Cache item name |
|
||||
* @param $value the data to save |
|
||||
* @param null $ttl Time To Live, in seconds (default 60) |
|
||||
* @param boolean $raw Whether to store the raw value. |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function save(string $key, $value, int $ttl = 60, bool $raw = false) |
|
||||
{ |
|
||||
$key = $this->prefix . $key; |
|
||||
|
|
||||
$this->cache[$key] = $value; |
|
||||
|
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Deletes a specific item from the cache store. |
|
||||
* |
|
||||
* @param string $key Cache item name |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function delete(string $key) |
|
||||
{ |
|
||||
unset($this->cache[$key]); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Performs atomic incrementation of a raw stored value. |
|
||||
* |
|
||||
* @param string $key Cache ID |
|
||||
* @param integer $offset Step/value to increase by |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function increment(string $key, int $offset = 1) |
|
||||
{ |
|
||||
$key = $this->prefix . $key; |
|
||||
|
|
||||
$data = $this->cache[$key] ?: null; |
|
||||
|
|
||||
if (empty($data)) |
|
||||
{ |
|
||||
$data = 0; |
|
||||
} |
|
||||
elseif (! is_int($data)) |
|
||||
{ |
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
return $this->save($key, $data + $offset); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Performs atomic decrementation of a raw stored value. |
|
||||
* |
|
||||
* @param string $key Cache ID |
|
||||
* @param integer $offset Step/value to increase by |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function decrement(string $key, int $offset = 1) |
|
||||
{ |
|
||||
$key = $this->prefix . $key; |
|
||||
|
|
||||
$data = $this->cache[$key] ?: null; |
|
||||
|
|
||||
if (empty($data)) |
|
||||
{ |
|
||||
$data = 0; |
|
||||
} |
|
||||
elseif (! is_int($data)) |
|
||||
{ |
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
return $this->save($key, $data - $offset); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Will delete all items in the entire cache. |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function clean() |
|
||||
{ |
|
||||
$this->cache = []; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Returns information on the entire cache. |
|
||||
* |
|
||||
* The information returned and the structure of the data |
|
||||
* varies depending on the handler. |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function getCacheInfo() |
|
||||
{ |
|
||||
return []; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Returns detailed information about the specific item in the cache. |
|
||||
* |
|
||||
* @param string $key Cache item name. |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function getMetaData(string $key) |
|
||||
{ |
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Determines if the driver is supported on this system. |
|
||||
* |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
public function isSupported(): bool |
|
||||
{ |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
@ -1,13 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\Commands; |
|
||||
|
|
||||
use CodeIgniter\CLI\BaseCommand; |
|
||||
|
|
||||
abstract class AbstractInfo extends BaseCommand |
|
||||
{ |
|
||||
|
|
||||
protected $group = 'demo'; |
|
||||
protected $name = 'app:pablo'; |
|
||||
protected $description = 'Displays basic application information.'; |
|
||||
|
|
||||
} |
|
@ -1,36 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\Commands; |
|
||||
|
|
||||
use CodeIgniter\CLI\BaseCommand; |
|
||||
use CodeIgniter\CLI\CLI; |
|
||||
use CodeIgniter\CodeIgniter; |
|
||||
|
|
||||
class AppInfo extends BaseCommand |
|
||||
{ |
|
||||
|
|
||||
protected $group = 'demo'; |
|
||||
protected $name = 'app:info'; |
|
||||
protected $description = 'Displays basic application information.'; |
|
||||
|
|
||||
public function run(array $params) |
|
||||
{ |
|
||||
CLI::write('CI Version: ' . CLI::color(CodeIgniter::CI_VERSION, 'red')); |
|
||||
} |
|
||||
|
|
||||
public function bomb() |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
CLI::color('test', 'white', 'Background'); |
|
||||
} |
|
||||
catch (\RuntimeException $oops) |
|
||||
{ |
|
||||
$this->showError($oops); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public function helpme() |
|
||||
{ |
|
||||
$this->call('help'); |
|
||||
} |
|
||||
} |
|
@ -1,18 +0,0 @@ |
|||||
<?php namespace CodeIgniter\Commands; |
|
||||
|
|
||||
class CommandsTestStreamFilter extends \php_user_filter |
|
||||
{ |
|
||||
public static $buffer = ''; |
|
||||
|
|
||||
public function filter($in, $out, &$consumed, $closing) |
|
||||
{ |
|
||||
while ($bucket = stream_bucket_make_writeable($in)) |
|
||||
{ |
|
||||
self::$buffer .= $bucket->data; |
|
||||
$consumed += $bucket->datalen; |
|
||||
} |
|
||||
return PSFS_PASS_ON; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
stream_filter_register('CommandsTestStreamFilter', 'CodeIgniter\Commands\CommandsTestStreamFilter'); |
|
@ -1,18 +0,0 @@ |
|||||
<?php namespace Tests\Support\Config; |
|
||||
|
|
||||
/** |
|
||||
* Class BadRegistrar |
|
||||
* |
|
||||
* Doesn't provides a basic registrar class for testing BaseConfig registration functions, |
|
||||
* because it doesn't return an associative array |
|
||||
*/ |
|
||||
|
|
||||
class BadRegistrar |
|
||||
{ |
|
||||
|
|
||||
public static function RegistrarConfig() |
|
||||
{ |
|
||||
return 'I am not worthy'; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,34 +0,0 @@ |
|||||
<?php namespace Tests\Support\Config; |
|
||||
|
|
||||
class MockAppConfig |
|
||||
{ |
|
||||
public $baseURL = 'http://example.com'; |
|
||||
|
|
||||
public $uriProtocol = 'REQUEST_URI'; |
|
||||
|
|
||||
public $cookiePrefix = ''; |
|
||||
public $cookieDomain = ''; |
|
||||
public $cookiePath = '/'; |
|
||||
public $cookieSecure = false; |
|
||||
public $cookieHTTPOnly = false; |
|
||||
|
|
||||
public $proxyIPs = ''; |
|
||||
|
|
||||
public $CSRFProtection = false; |
|
||||
public $CSRFTokenName = 'csrf_test_name'; |
|
||||
public $CSRFHeaderName = 'X-CSRF-TOKEN'; |
|
||||
public $CSRFCookieName = 'csrf_cookie_name'; |
|
||||
public $CSRFExpire = 7200; |
|
||||
public $CSRFRegenerate = true; |
|
||||
public $CSRFExcludeURIs = ['http://example.com']; |
|
||||
public $CSRFRedirect = false; |
|
||||
|
|
||||
public $CSPEnabled = false; |
|
||||
|
|
||||
public $defaultLocale = 'en'; |
|
||||
public $negotiateLocale = false; |
|
||||
public $supportedLocales = [ |
|
||||
'en', |
|
||||
'es', |
|
||||
]; |
|
||||
} |
|
@ -1,21 +0,0 @@ |
|||||
<?php namespace Tests\Support\Config; |
|
||||
|
|
||||
use Config\Autoload; |
|
||||
|
|
||||
class MockAutoload extends Autoload |
|
||||
{ |
|
||||
public $psr4 = []; |
|
||||
|
|
||||
public $classmap = []; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function __construct() |
|
||||
{ |
|
||||
// Don't call the parent since we don't want the default mappings. |
|
||||
// parent::__construct(); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
@ -1,32 +0,0 @@ |
|||||
<?php namespace Tests\Support\Config; |
|
||||
|
|
||||
class MockCLIConfig extends \Config\App |
|
||||
{ |
|
||||
public $baseURL = 'http://example.com'; |
|
||||
|
|
||||
public $uriProtocol = 'REQUEST_URI'; |
|
||||
|
|
||||
public $cookiePrefix = ''; |
|
||||
public $cookieDomain = ''; |
|
||||
public $cookiePath = '/'; |
|
||||
public $cookieSecure = false; |
|
||||
public $cookieHTTPOnly = false; |
|
||||
|
|
||||
public $proxyIPs = ''; |
|
||||
|
|
||||
public $CSRFProtection = false; |
|
||||
public $CSRFTokenName = 'csrf_test_name'; |
|
||||
public $CSRFCookieName = 'csrf_cookie_name'; |
|
||||
public $CSRFExpire = 7200; |
|
||||
public $CSRFRegenerate = true; |
|
||||
public $CSRFExcludeURIs = ['http://example.com']; |
|
||||
|
|
||||
public $CSPEnabled = false; |
|
||||
|
|
||||
public $defaultLocale = 'en'; |
|
||||
public $negotiateLocale = false; |
|
||||
public $supportedLocales = [ |
|
||||
'en', |
|
||||
'es', |
|
||||
]; |
|
||||
} |
|
@ -1,103 +0,0 @@ |
|||||
<?php namespace Tests\Support\Config; |
|
||||
|
|
||||
class MockLogger |
|
||||
{ |
|
||||
/* |
|
||||
|-------------------------------------------------------------------------- |
|
||||
| Error Logging Threshold |
|
||||
|-------------------------------------------------------------------------- |
|
||||
| |
|
||||
| You can enable error logging by setting a threshold over zero. The |
|
||||
| threshold determines what gets logged. Any values below or equal to the |
|
||||
| threshold will be logged. Threshold options are: |
|
||||
| |
|
||||
| 0 = Disables logging, Error logging TURNED OFF |
|
||||
| 1 = Emergency Messages - System is unusable |
|
||||
| 2 = Alert Messages - Action Must Be Taken Immediately |
|
||||
| 3 = Critical Messages - Application component unavailable, unexpected exception. |
|
||||
| 4 = Runtime Errors - Don't need immediate action, but should be monitored. |
|
||||
| 5 = Warnings - Exceptional occurrences that are not errors. |
|
||||
| 6 = Notices - Normal but significant events. |
|
||||
| 7 = Info - Interesting events, like user logging in, etc. |
|
||||
| 8 = Debug - Detailed debug information. |
|
||||
| 9 = All Messages |
|
||||
| |
|
||||
| You can also pass an array with threshold levels to show individual error types |
|
||||
| |
|
||||
| array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages |
|
||||
| |
|
||||
| For a live site you'll usually enable Critical or higher (3) to be logged otherwise |
|
||||
| your log files will fill up very fast. |
|
||||
| |
|
||||
*/ |
|
||||
|
|
||||
public $threshold = 9; |
|
||||
|
|
||||
/* |
|
||||
|-------------------------------------------------------------------------- |
|
||||
| Error Logging Directory Path |
|
||||
|-------------------------------------------------------------------------- |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
*/ |
|
||||
public $path = ''; |
|
||||
|
|
||||
/* |
|
||||
|-------------------------------------------------------------------------- |
|
||||
| Date Format for Logs |
|
||||
|-------------------------------------------------------------------------- |
|
||||
| |
|
||||
| Each item that is logged has an associated date. You can use PHP date |
|
||||
| codes to set your own date formatting |
|
||||
| |
|
||||
*/ |
|
||||
public $dateFormat = 'Y-m-d'; |
|
||||
|
|
||||
/* |
|
||||
|-------------------------------------------------------------------------- |
|
||||
| Log Handlers |
|
||||
|-------------------------------------------------------------------------- |
|
||||
| |
|
||||
| The logging system supports multiple actions to be taken when something |
|
||||
| is logged. This is done by allowing for multiple Handlers, special classes |
|
||||
| designed to write the log to their chosen destinations, whether that is |
|
||||
| a file on the getServer, a cloud-based service, or even taking actions such |
|
||||
| as emailing the dev team. |
|
||||
| |
|
||||
| Each handler is defined by the class name used for that handler, and it |
|
||||
| MUST implement the CodeIgniter\Log\Handlers\HandlerInterface interface. |
|
||||
| |
|
||||
| The value of each key is an array of configuration items that are sent |
|
||||
| to the constructor of each handler. The only required configuration item |
|
||||
| is the 'handles' element, which must be an array of integer log levels. |
|
||||
| This is most easily handled by using the constants defined in the |
|
||||
| Psr\Log\LogLevel class. |
|
||||
| |
|
||||
| Handlers are executed in the order defined in this array, starting with |
|
||||
| the handler on top and continuing down. |
|
||||
| |
|
||||
*/ |
|
||||
public $handlers = [ |
|
||||
//-------------------------------------------------------------------- |
|
||||
// File Handler |
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
'Tests\Support\Log\Handlers\TestHandler' => [ |
|
||||
/* |
|
||||
* The log levels that this handler will handle. |
|
||||
*/ |
|
||||
'handles' => [ |
|
||||
'critical', |
|
||||
'alert', |
|
||||
'emergency', |
|
||||
'debug', |
|
||||
'error', |
|
||||
'info', |
|
||||
'notice', |
|
||||
'warning', |
|
||||
], |
|
||||
], |
|
||||
]; |
|
||||
|
|
||||
} |
|
@ -1,28 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\Config; |
|
||||
|
|
||||
use \CodeIgniter\Config\BaseService; |
|
||||
|
|
||||
class MockServices extends BaseService |
|
||||
{ |
|
||||
|
|
||||
public $psr4 = [ |
|
||||
'Tests/Support' => TESTPATH . '_support/', |
|
||||
]; |
|
||||
public $classmap = []; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function __construct() |
|
||||
{ |
|
||||
// Don't call the parent since we don't want the default mappings. |
|
||||
// parent::__construct(); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
public static function locator(bool $getShared = true) |
|
||||
{ |
|
||||
return new \CodeIgniter\Autoloader\FileLocator(static::autoloader()); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,27 +0,0 @@ |
|||||
<?php namespace Tests\Support\Config; |
|
||||
|
|
||||
/** |
|
||||
* Class Registrar |
|
||||
* |
|
||||
* Provides a basic registrar class for testing BaseConfig registration functions. |
|
||||
*/ |
|
||||
|
|
||||
class Registrar |
|
||||
{ |
|
||||
|
|
||||
public static function RegistrarConfig() |
|
||||
{ |
|
||||
return [ |
|
||||
'bar' => [ |
|
||||
'first', |
|
||||
'second', |
|
||||
], |
|
||||
'format' => 'nice', |
|
||||
'fruit' => [ |
|
||||
'apple', |
|
||||
'banana', |
|
||||
], |
|
||||
]; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,7 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
/** |
|
||||
* This is a simple file to include for testing the RouteCollection class. |
|
||||
*/ |
|
||||
|
|
||||
$routes->add('testing', 'TestController::index'); |
|
@ -1,77 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\Controllers; |
|
||||
|
|
||||
use CodeIgniter\API\ResponseTrait; |
|
||||
use CodeIgniter\Controller; |
|
||||
use CodeIgniter\HTTP\Exceptions\HTTPException; |
|
||||
|
|
||||
/** |
|
||||
* This is a testing only controller, intended to blow up in multiple |
|
||||
* ways to make sure we catch them. |
|
||||
*/ |
|
||||
class Popcorn extends Controller |
|
||||
{ |
|
||||
|
|
||||
use ResponseTrait; |
|
||||
|
|
||||
public function index() |
|
||||
{ |
|
||||
return 'Hi there'; |
|
||||
} |
|
||||
|
|
||||
public function pop() |
|
||||
{ |
|
||||
$this->respond('Oops', 567, 'Surprise'); |
|
||||
} |
|
||||
|
|
||||
public function popper() |
|
||||
{ |
|
||||
throw new \RuntimeException('Surprise', 500); |
|
||||
} |
|
||||
|
|
||||
public function weasel() |
|
||||
{ |
|
||||
$this->respond('', 200); |
|
||||
} |
|
||||
|
|
||||
public function oops() |
|
||||
{ |
|
||||
$this->failUnauthorized(); |
|
||||
} |
|
||||
|
|
||||
public function goaway() |
|
||||
{ |
|
||||
return redirect()->to('/'); |
|
||||
} |
|
||||
|
|
||||
// @see https://github.com/codeigniter4/CodeIgniter4/issues/1834 |
|
||||
public function index3() |
|
||||
{ |
|
||||
$response = $this->response->setJSON([ |
|
||||
'lang' => $this->request->getLocale(), |
|
||||
]); |
|
||||
|
|
||||
// echo var_dump($this->response->getBody()); |
|
||||
return $response; |
|
||||
} |
|
||||
|
|
||||
public function canyon() |
|
||||
{ |
|
||||
echo 'Hello-o-o'; |
|
||||
} |
|
||||
|
|
||||
public function cat() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public function json() |
|
||||
{ |
|
||||
$this->responsd(['answer' => 42]); |
|
||||
} |
|
||||
|
|
||||
public function xml() |
|
||||
{ |
|
||||
$this->respond('<my><pet>cat</pet></my>'); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,148 +0,0 @@ |
|||||
<?php namespace Tests\Support\Database\Migrations; |
|
||||
|
|
||||
class Migration_Create_test_tables extends \CodeIgniter\Database\Migration |
|
||||
{ |
|
||||
public function up() |
|
||||
{ |
|
||||
// SQLite3 uses auto increment different |
|
||||
$unique_or_auto = $this->db->DBDriver === 'SQLite3' ? 'unique' : 'auto_increment'; |
|
||||
|
|
||||
// User Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'name' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 80, |
|
||||
], |
|
||||
'email' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 100, |
|
||||
], |
|
||||
'country' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'created_at' => [ |
|
||||
'type' => 'DATETIME', |
|
||||
'null' => true, |
|
||||
], |
|
||||
'updated_at' => [ |
|
||||
'type' => 'DATETIME', |
|
||||
'null' => true, |
|
||||
], |
|
||||
'deleted_at' => [ |
|
||||
'type' => 'DATETIME', |
|
||||
'null' => true, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('user', true); |
|
||||
|
|
||||
// Job Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'name' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'description' => [ |
|
||||
'type' => 'TEXT', |
|
||||
'null' => true, |
|
||||
], |
|
||||
'created_at' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 11, |
|
||||
'null' => true, |
|
||||
], |
|
||||
'updated_at' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 11, |
|
||||
'null' => true, |
|
||||
], |
|
||||
'deleted_at' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 11, |
|
||||
'null' => true, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('job', true); |
|
||||
|
|
||||
// Misc Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'key' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'value' => ['type' => 'TEXT'], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('misc', true); |
|
||||
|
|
||||
// Empty Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'name' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'created_at' => [ |
|
||||
'type' => 'DATE', |
|
||||
'null' => true, |
|
||||
], |
|
||||
'updated_at' => [ |
|
||||
'type' => 'DATE', |
|
||||
'null' => true, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('empty', true); |
|
||||
|
|
||||
// Secondary Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'key' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'value' => ['type' => 'TEXT'], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('secondary', true); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function down() |
|
||||
{ |
|
||||
$this->forge->dropTable('user', true); |
|
||||
$this->forge->dropTable('job', true); |
|
||||
$this->forge->dropTable('misc', true); |
|
||||
$this->forge->dropTable('empty', true); |
|
||||
$this->forge->dropTable('secondary', true); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
@ -1,15 +0,0 @@ |
|||||
<?php namespace Tests\Support\Database; |
|
||||
|
|
||||
use CodeIgniter\Database\BaseBuilder; |
|
||||
use CodeIgniter\Database\ConnectionInterface; |
|
||||
|
|
||||
class MockBuilder extends BaseBuilder { |
|
||||
|
|
||||
public function __construct($tableName, ConnectionInterface &$db, array $options = null) |
|
||||
{ |
|
||||
parent::__construct($tableName, $db, $options); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
@ -1,298 +0,0 @@ |
|||||
<?php namespace Tests\Support\Database; |
|
||||
|
|
||||
use CodeIgniter\CodeIgniter; |
|
||||
use CodeIgniter\Database\BaseConnection; |
|
||||
|
|
||||
class MockConnection extends BaseConnection |
|
||||
{ |
|
||||
protected $returnValues = []; |
|
||||
|
|
||||
public $database; |
|
||||
|
|
||||
public $lastQuery; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function shouldReturn(string $method, $return) |
|
||||
{ |
|
||||
$this->returnValues[$method] = $return; |
|
||||
|
|
||||
return $this; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Orchestrates a query against the database. Queries must use |
|
||||
* Database\Statement objects to store the query and build it. |
|
||||
* This method works with the cache. |
|
||||
* |
|
||||
* Should automatically handle different connections for read/write |
|
||||
* queries if needed. |
|
||||
* |
|
||||
* @param string $sql |
|
||||
* @param mixed ...$binds |
|
||||
* @param boolean $setEscapeFlags |
|
||||
* @param string $queryClass |
|
||||
* |
|
||||
* @return \CodeIgniter\Database\BaseResult|\CodeIgniter\Database\Query|false |
|
||||
*/ |
|
||||
|
|
||||
public function query(string $sql, $binds = null, bool $setEscapeFlags = true, string $queryClass = 'CodeIgniter\\Database\\Query') |
|
||||
{ |
|
||||
$queryClass = str_replace('Connection', 'Query', get_class($this)); |
|
||||
|
|
||||
$query = new $queryClass($this); |
|
||||
|
|
||||
$query->setQuery($sql, $binds, $setEscapeFlags); |
|
||||
|
|
||||
if (! empty($this->swapPre) && ! empty($this->DBPrefix)) |
|
||||
{ |
|
||||
$query->swapPrefix($this->DBPrefix, $this->swapPre); |
|
||||
} |
|
||||
|
|
||||
$startTime = microtime(true); |
|
||||
|
|
||||
$this->lastQuery = $query; |
|
||||
|
|
||||
// Run the query |
|
||||
if (false === ($this->resultID = $this->simpleQuery($query->getQuery()))) |
|
||||
{ |
|
||||
$query->setDuration($startTime, $startTime); |
|
||||
|
|
||||
// @todo deal with errors |
|
||||
|
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
$query->setDuration($startTime); |
|
||||
|
|
||||
$resultClass = str_replace('Connection', 'Result', get_class($this)); |
|
||||
|
|
||||
return new $resultClass($this->connID, $this->resultID); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Connect to the database. |
|
||||
* |
|
||||
* @param boolean $persistent |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function connect(bool $persistent = false) |
|
||||
{ |
|
||||
$return = $this->returnValues['connect'] ?? true; |
|
||||
|
|
||||
if (is_array($return)) |
|
||||
{ |
|
||||
// By removing the top item here, we can |
|
||||
// get a different value for, say, testing failover connections. |
|
||||
$return = array_shift($this->returnValues['connect']); |
|
||||
} |
|
||||
|
|
||||
return $return; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Keep or establish the connection if no queries have been sent for |
|
||||
* a length of time exceeding the server's idle timeout. |
|
||||
* |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
public function reconnect(): bool |
|
||||
{ |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Select a specific database table to use. |
|
||||
* |
|
||||
* @param string $databaseName |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function setDatabase(string $databaseName) |
|
||||
{ |
|
||||
$this->database = $databaseName; |
|
||||
|
|
||||
return $this; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Returns a string containing the version of the database being used. |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function getVersion(): string |
|
||||
{ |
|
||||
return CodeIgniter::CI_VERSION; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Executes the query against the database. |
|
||||
* |
|
||||
* @param string $sql |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
protected function execute(string $sql) |
|
||||
{ |
|
||||
return $this->returnValues['execute']; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Returns the total number of rows affected by this query. |
|
||||
* |
|
||||
* @return integer |
|
||||
*/ |
|
||||
public function affectedRows(): int |
|
||||
{ |
|
||||
return 1; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Returns the last error code and message. |
|
||||
* |
|
||||
* Must return an array with keys 'code' and 'message': |
|
||||
* |
|
||||
* return ['code' => null, 'message' => null); |
|
||||
* |
|
||||
* @return array |
|
||||
*/ |
|
||||
public function error(): array |
|
||||
{ |
|
||||
return [ |
|
||||
'code' => null, |
|
||||
'message' => null, |
|
||||
]; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Insert ID |
|
||||
* |
|
||||
* @return integer |
|
||||
*/ |
|
||||
public function insertID(): int |
|
||||
{ |
|
||||
return $this->connID->insert_id; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Generates the SQL for listing tables in a platform-dependent manner. |
|
||||
* |
|
||||
* @param boolean $constrainByPrefix |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function _listTables(bool $constrainByPrefix = false): string |
|
||||
{ |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Generates a platform-specific query string so that the column names can be fetched. |
|
||||
* |
|
||||
* @param string $table |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function _listColumns(string $table = ''): string |
|
||||
{ |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* @param string $table |
|
||||
* @return array |
|
||||
*/ |
|
||||
protected function _fieldData(string $table): array |
|
||||
{ |
|
||||
return []; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* @param string $table |
|
||||
* @return array |
|
||||
*/ |
|
||||
protected function _indexData(string $table): array |
|
||||
{ |
|
||||
return []; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* @param string $table |
|
||||
* @return array |
|
||||
*/ |
|
||||
protected function _foreignKeyData(string $table): array |
|
||||
{ |
|
||||
return []; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Close the connection. |
|
||||
*/ |
|
||||
protected function _close() |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Begin Transaction |
|
||||
* |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
protected function _transBegin(): bool |
|
||||
{ |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Commit Transaction |
|
||||
* |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
protected function _transCommit(): bool |
|
||||
{ |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Rollback Transaction |
|
||||
* |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
protected function _transRollback(): bool |
|
||||
{ |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
} |
|
@ -1,8 +0,0 @@ |
|||||
<?php namespace Tests\Support\Database; |
|
||||
|
|
||||
use CodeIgniter\Database\Query; |
|
||||
|
|
||||
class MockQuery extends Query |
|
||||
{ |
|
||||
|
|
||||
} |
|
@ -1,93 +0,0 @@ |
|||||
<?php namespace Tests\Support\Database; |
|
||||
|
|
||||
use CodeIgniter\Database\BaseResult; |
|
||||
|
|
||||
class MockResult extends BaseResult |
|
||||
{ |
|
||||
/** |
|
||||
* Gets the number of fields in the result set. |
|
||||
* |
|
||||
* @return integer |
|
||||
*/ |
|
||||
public function getFieldCount(): int |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Generates an array of column names in the result set. |
|
||||
* |
|
||||
* @return array |
|
||||
*/ |
|
||||
public function getFieldNames(): array |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Generates an array of objects representing field meta-data. |
|
||||
* |
|
||||
* @return array |
|
||||
*/ |
|
||||
public function getFieldData(): array |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Frees the current result. |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function freeResult() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Moves the internal pointer to the desired offset. This is called |
|
||||
* internally before fetching results to make sure the result set |
|
||||
* starts at zero. |
|
||||
* |
|
||||
* @param integer $n |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
public function dataSeek($n = 0) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Returns the result set as an array. |
|
||||
* |
|
||||
* Overridden by driver classes. |
|
||||
* |
|
||||
* @return mixed |
|
||||
*/ |
|
||||
protected function fetchAssoc() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Returns the result set as an object. |
|
||||
* |
|
||||
* Overridden by child classes. |
|
||||
* |
|
||||
* @param string $className |
|
||||
* |
|
||||
* @return object |
|
||||
*/ |
|
||||
protected function fetchObject($className = 'stdClass') |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
} |
|
@ -1,7 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
namespace Tests\Support\Database; |
|
||||
|
|
||||
class MockTestClass |
|
||||
{ |
|
||||
} |
|
@ -1,78 +0,0 @@ |
|||||
<?php namespace Tests\Support\Database\Seeds; |
|
||||
|
|
||||
class CITestSeeder extends \CodeIgniter\Database\Seeder |
|
||||
{ |
|
||||
public function run() |
|
||||
{ |
|
||||
// Job Data |
|
||||
$data = [ |
|
||||
'user' => [ |
|
||||
[ |
|
||||
'name' => 'Derek Jones', |
|
||||
'email' => 'derek@world.com', |
|
||||
'country' => 'US', |
|
||||
], |
|
||||
[ |
|
||||
'name' => 'Ahmadinejad', |
|
||||
'email' => 'ahmadinejad@world.com', |
|
||||
'country' => 'Iran', |
|
||||
], |
|
||||
[ |
|
||||
'name' => 'Richard A Causey', |
|
||||
'email' => 'richard@world.com', |
|
||||
'country' => 'US', |
|
||||
], |
|
||||
[ |
|
||||
'name' => 'Chris Martin', |
|
||||
'email' => 'chris@world.com', |
|
||||
'country' => 'UK', |
|
||||
], |
|
||||
], |
|
||||
'job' => [ |
|
||||
[ |
|
||||
'name' => 'Developer', |
|
||||
'description' => 'Awesome job, but sometimes makes you bored', |
|
||||
], |
|
||||
[ |
|
||||
'name' => 'Politician', |
|
||||
'description' => 'This is not really a job', |
|
||||
], |
|
||||
[ |
|
||||
'name' => 'Accountant', |
|
||||
'description' => 'Boring job, but you will get free snack at lunch', |
|
||||
], |
|
||||
[ |
|
||||
'name' => 'Musician', |
|
||||
'description' => 'Only Coldplay can actually called Musician', |
|
||||
], |
|
||||
], |
|
||||
'misc' => [ |
|
||||
[ |
|
||||
'key' => '\\xxxfoo456', |
|
||||
'value' => 'Entry with \\xxx', |
|
||||
], |
|
||||
[ |
|
||||
'key' => '\\%foo456', |
|
||||
'value' => 'Entry with \\%', |
|
||||
], |
|
||||
[ |
|
||||
'key' => 'spaces and tabs', |
|
||||
'value' => ' One two three tab', |
|
||||
], |
|
||||
], |
|
||||
]; |
|
||||
|
|
||||
foreach ($data as $table => $dummy_data) |
|
||||
{ |
|
||||
$this->db->table($table)->truncate(); |
|
||||
|
|
||||
foreach ($dummy_data as $single_dummy_data) |
|
||||
{ |
|
||||
$this->db->table($table)->insert($single_dummy_data); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
@ -1,24 +0,0 @@ |
|||||
<?php namespace App\Database\Migrations; |
|
||||
|
|
||||
class Migration_some_migration extends \CodeIgniter\Database\Migration |
|
||||
{ |
|
||||
public function up() |
|
||||
{ |
|
||||
$this->forge->addField([ |
|
||||
'key' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 255, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->createTable('foo', true); |
|
||||
|
|
||||
$this->db->table('foo')->insert([ |
|
||||
'key' => 'foobar', |
|
||||
]); |
|
||||
} |
|
||||
|
|
||||
public function down() |
|
||||
{ |
|
||||
$this->forge->dropTable('foo', true); |
|
||||
} |
|
||||
} |
|
@ -1,148 +0,0 @@ |
|||||
<?php namespace Tests\Support\DatabaseTestMigrations\Database\Migrations; |
|
||||
|
|
||||
class Migration_Create_test_tables extends \CodeIgniter\Database\Migration |
|
||||
{ |
|
||||
public function up() |
|
||||
{ |
|
||||
// SQLite3 uses auto increment different |
|
||||
$unique_or_auto = $this->db->DBDriver === 'SQLite3' ? 'unique' : 'auto_increment'; |
|
||||
|
|
||||
// User Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'name' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 80, |
|
||||
], |
|
||||
'email' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 100, |
|
||||
], |
|
||||
'country' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'created_at' => [ |
|
||||
'type' => 'DATETIME', |
|
||||
'null' => true, |
|
||||
], |
|
||||
'updated_at' => [ |
|
||||
'type' => 'DATETIME', |
|
||||
'null' => true, |
|
||||
], |
|
||||
'deleted_at' => [ |
|
||||
'type' => 'DATETIME', |
|
||||
'null' => true, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('user', true); |
|
||||
|
|
||||
// Job Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'name' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'description' => [ |
|
||||
'type' => 'TEXT', |
|
||||
'null' => true, |
|
||||
], |
|
||||
'created_at' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 11, |
|
||||
'null' => true, |
|
||||
], |
|
||||
'updated_at' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 11, |
|
||||
'null' => true, |
|
||||
], |
|
||||
'deleted_at' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 11, |
|
||||
'null' => true, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('job', true); |
|
||||
|
|
||||
// Misc Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'key' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'value' => ['type' => 'TEXT'], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('misc', true); |
|
||||
|
|
||||
// Empty Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'name' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'created_at' => [ |
|
||||
'type' => 'DATE', |
|
||||
'null' => true, |
|
||||
], |
|
||||
'updated_at' => [ |
|
||||
'type' => 'DATE', |
|
||||
'null' => true, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('empty', true); |
|
||||
|
|
||||
// Secondary Table |
|
||||
$this->forge->addField([ |
|
||||
'id' => [ |
|
||||
'type' => 'INTEGER', |
|
||||
'constraint' => 3, |
|
||||
$unique_or_auto => true, |
|
||||
], |
|
||||
'key' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 40, |
|
||||
], |
|
||||
'value' => ['type' => 'TEXT'], |
|
||||
]); |
|
||||
$this->forge->addKey('id', true); |
|
||||
$this->forge->createTable('secondary', true); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function down() |
|
||||
{ |
|
||||
$this->forge->dropTable('user', true); |
|
||||
$this->forge->dropTable('job', true); |
|
||||
$this->forge->dropTable('misc', true); |
|
||||
$this->forge->dropTable('empty', true); |
|
||||
$this->forge->dropTable('secondary', true); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
@ -1,66 +0,0 @@ |
|||||
<?php namespace Tests\Support\Events; |
|
||||
|
|
||||
/** |
|
||||
* CodeIgniter |
|
||||
* |
|
||||
* An open source application development framework for PHP |
|
||||
* |
|
||||
* This content is released under the MIT License (MIT) |
|
||||
* |
|
||||
* Copyright (c) 2014-2018 British Columbia Institute of Technology |
|
||||
* |
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
||||
* of this software and associated documentation files (the "Software"), to deal |
|
||||
* in the Software without restriction, including without limitation the rights |
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
||||
* copies of the Software, and to permit persons to whom the Software is |
|
||||
* furnished to do so, subject to the following conditions: |
|
||||
* |
|
||||
* The above copyright notice and this permission notice shall be included in |
|
||||
* all copies or substantial portions of the Software. |
|
||||
* |
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
||||
* THE SOFTWARE. |
|
||||
* |
|
||||
* @package CodeIgniter |
|
||||
* @author CodeIgniter Dev Team |
|
||||
* @copyright 2014-2018 British Columbia Institute of Technology (https://bcit.ca/) |
|
||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||
* @link https://codeigniter.com |
|
||||
* @since Version 4.0.0 |
|
||||
* @filesource |
|
||||
*/ |
|
||||
|
|
||||
use CodeIgniter\Events\Events; |
|
||||
|
|
||||
/** |
|
||||
* Events |
|
||||
*/ |
|
||||
class MockEvents extends Events |
|
||||
{ |
|
||||
|
|
||||
public function getListeners() |
|
||||
{ |
|
||||
return self::$listeners; |
|
||||
} |
|
||||
|
|
||||
public function getEventsFile() |
|
||||
{ |
|
||||
return self::$eventsFile; |
|
||||
} |
|
||||
|
|
||||
public function getSimulate() |
|
||||
{ |
|
||||
return self::$simulate; |
|
||||
} |
|
||||
|
|
||||
public function unInitialize() |
|
||||
{ |
|
||||
static::$initialized = false; |
|
||||
} |
|
||||
} |
|
@ -1,6 +0,0 @@ |
|||||
<?php |
|
||||
/* |
|
||||
* To change this license header, choose License Headers in Project Properties. |
|
||||
* To change this template file, choose Tools | Templates |
|
||||
* and open the template in the editor. |
|
||||
*/ |
|
@ -1,6 +0,0 @@ |
|||||
<?php |
|
||||
/* |
|
||||
* To change this license header, choose License Headers in Project Properties. |
|
||||
* To change this template file, choose Tools | Templates |
|
||||
* and open the template in the editor. |
|
||||
*/ |
|
@ -1,6 +0,0 @@ |
|||||
<?php |
|
||||
/* |
|
||||
* To change this license header, choose License Headers in Project Properties. |
|
||||
* To change this template file, choose Tools | Templates |
|
||||
* and open the template in the editor. |
|
||||
*/ |
|
@ -1,6 +0,0 @@ |
|||||
<?php |
|
||||
/* |
|
||||
* To change this license header, choose License Headers in Project Properties. |
|
||||
* To change this template file, choose Tools | Templates |
|
||||
* and open the template in the editor. |
|
||||
*/ |
|
@ -1 +0,0 @@ |
|||||
|
|
@ -1 +0,0 @@ |
|||||
|
|
@ -1 +0,0 @@ |
|||||
|
|
@ -1,52 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
namespace Tests\Support\HTTP; |
|
||||
|
|
||||
use CodeIgniter\HTTP\CURLRequest; |
|
||||
|
|
||||
/** |
|
||||
* Class MockCURLRequest |
|
||||
* |
|
||||
* Simply allows us to not actually call cURL during the |
|
||||
* test runs. Instead, we can set the desired output |
|
||||
* and get back the set options. |
|
||||
*/ |
|
||||
class MockCURLRequest extends CURLRequest |
|
||||
{ |
|
||||
|
|
||||
public $curl_options; |
|
||||
protected $output = ''; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function setOutput($output) |
|
||||
{ |
|
||||
$this->output = $output; |
|
||||
|
|
||||
return $this; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
protected function sendRequest(array $curl_options = []): string |
|
||||
{ |
|
||||
// Save so we can access later. |
|
||||
$this->curl_options = $curl_options; |
|
||||
|
|
||||
return $this->output; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
// for testing purposes only |
|
||||
public function getBaseURI() |
|
||||
{ |
|
||||
return $this->baseURI; |
|
||||
} |
|
||||
|
|
||||
// for testing purposes only |
|
||||
public function getDelay() |
|
||||
{ |
|
||||
return $this->delay; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,17 +0,0 @@ |
|||||
<?php namespace Tests\Support\HTTP; |
|
||||
|
|
||||
use CodeIgniter\HTTP\IncomingRequest; |
|
||||
|
|
||||
class MockIncomingRequest extends IncomingRequest |
|
||||
{ |
|
||||
// public function populateHeaders() |
|
||||
// { |
|
||||
// // Don't do anything... force the tester to manually set the headers they want. |
|
||||
// } |
|
||||
|
|
||||
public function detectURI($protocol, $baseURL) |
|
||||
{ |
|
||||
// Do nothing... |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,31 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\HTTP; |
|
||||
|
|
||||
use CodeIgniter\HTTP\Response; |
|
||||
|
|
||||
/** |
|
||||
* Class MockResponse |
|
||||
*/ |
|
||||
class MockResponse extends Response |
|
||||
{ |
|
||||
|
|
||||
/** |
|
||||
* If true, will not write output. Useful during testing. |
|
||||
* |
|
||||
* @var boolean |
|
||||
*/ |
|
||||
protected $pretend = true; |
|
||||
|
|
||||
// for testing |
|
||||
public function getPretend() |
|
||||
{ |
|
||||
return $this->pretend; |
|
||||
} |
|
||||
|
|
||||
// artificial error for testing |
|
||||
public function misbehave() |
|
||||
{ |
|
||||
$this->statusCode = 0; |
|
||||
} |
|
||||
|
|
||||
} |
|
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 4.4 KiB |
@ -1,61 +0,0 @@ |
|||||
<?php namespace Tests\Support\Language; |
|
||||
|
|
||||
use CodeIgniter\Language\Language; |
|
||||
|
|
||||
class MockLanguage extends Language |
|
||||
{ |
|
||||
|
|
||||
/** |
|
||||
* Stores the data that should be |
|
||||
* returned by the 'requireFile()' method. |
|
||||
* |
|
||||
* @var mixed |
|
||||
*/ |
|
||||
protected $data; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Sets the data that should be returned by the |
|
||||
* 'requireFile()' method to allow easy overrides |
|
||||
* during testing. |
|
||||
* |
|
||||
* @param array $data |
|
||||
* @param string $file |
|
||||
* @param string|null $locale |
|
||||
* |
|
||||
* @return $this |
|
||||
*/ |
|
||||
public function setData(string $file, array $data, string $locale = null) |
|
||||
{ |
|
||||
$this->language[$locale ?? $this->locale][$file] = $data; |
|
||||
|
|
||||
return $this; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Provides an override that allows us to set custom |
|
||||
* data to be returned easily during testing. |
|
||||
* |
|
||||
* @param string $path |
|
||||
* |
|
||||
* @return array|mixed |
|
||||
*/ |
|
||||
protected function requireFile(string $path): array |
|
||||
{ |
|
||||
return $this->data ?? []; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Arbitrarily turnoff internationalization support for testing |
|
||||
*/ |
|
||||
public function disableIntlSupport() |
|
||||
{ |
|
||||
$this->intlSupport = false; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,27 +0,0 @@ |
|||||
<?php namespace Tests\Support\Language; |
|
||||
|
|
||||
use CodeIgniter\Language\Language; |
|
||||
|
|
||||
class SecondMockLanguage extends Language |
|
||||
{ |
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Expose the protected *load* method |
|
||||
*/ |
|
||||
public function loadem(string $file, string $locale = 'en', bool $return = false) |
|
||||
{ |
|
||||
return $this->load($file, $locale, $return); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Expose the loaded language files |
|
||||
*/ |
|
||||
public function loaded(string $locale = 'en') |
|
||||
{ |
|
||||
return $this->loadedFiles[$locale]; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,8 +0,0 @@ |
|||||
<?php |
|
||||
// seven wonders of the ancient world |
|
||||
return [ |
|
||||
'one' => 'Pyramid of Giza', |
|
||||
'tre' => 'Colossus of Rhodes', |
|
||||
'fiv' => 'Temple of Artemis', |
|
||||
'sev' => 'Hanging Gardens of Babylon', |
|
||||
]; |
|
@ -1,8 +0,0 @@ |
|||||
<?php |
|
||||
// seven deadly sins |
|
||||
return [ |
|
||||
'two' => 'gluttony', |
|
||||
'tre' => 'greed', |
|
||||
'six' => 'envy', |
|
||||
'sev' => 'pride', |
|
||||
]; |
|
@ -1,6 +0,0 @@ |
|||||
<?php |
|
||||
return [ |
|
||||
'strongForce' => 'These are not the droids you are looking for', |
|
||||
'notaMoon' => "It's made of cheese", |
|
||||
'wisdom' => 'There is no try', |
|
||||
]; |
|
@ -1,8 +0,0 @@ |
|||||
<?php |
|
||||
// 12 days of Christmas |
|
||||
return [ |
|
||||
'for' => 'four calling birds', |
|
||||
'fiv' => 'five golden rings', |
|
||||
'six' => 'six geese a laying', |
|
||||
'sev' => 'seven swans a swimming', |
|
||||
]; |
|
@ -1,20 +0,0 @@ |
|||||
<?php |
|
||||
/** |
|
||||
* Core language strings. |
|
||||
* |
|
||||
* @package CodeIgniter |
|
||||
* @author CodeIgniter Dev Team |
|
||||
* @copyright 2014-2018 British Columbia Institute of Technology (https://bcit.ca/) |
|
||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||
* @link https://codeigniter.com |
|
||||
* @since Version 4.0.0 |
|
||||
* @filesource |
|
||||
* |
|
||||
* @codeCoverageIgnore |
|
||||
*/ |
|
||||
|
|
||||
// looking for a system message not likely to be part of unit testing |
|
||||
return [ |
|
||||
'missingExtension' => '{0} extension could not be found.', |
|
||||
'bazillion' => 'billions and billions', // adds a new setting |
|
||||
]; |
|
@ -1,7 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
return [ |
|
||||
'strongForce' => 'These are not the droids you are looking for', |
|
||||
'notaMoon' => "That's no moon... it's a space station", |
|
||||
'cannotMove' => 'I have a very bad feeling about this', |
|
||||
]; |
|
@ -1,5 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
return [ |
|
||||
'languageGetLineInvalidArgumentException' => 'Whatever this would be, translated', |
|
||||
]; |
|
@ -1,25 +0,0 @@ |
|||||
<?php namespace Tests\Support\Log\Handlers; |
|
||||
|
|
||||
/** |
|
||||
* Class MockHandler |
|
||||
* |
|
||||
* Extends ChromeLoggerHandler, exposing some inner workings |
|
||||
*/ |
|
||||
|
|
||||
class MockChromeHandler extends \CodeIgniter\Log\Handlers\ChromeLoggerHandler |
|
||||
{ |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function __construct(array $config) |
|
||||
{ |
|
||||
parent::__construct($config); |
|
||||
} |
|
||||
|
|
||||
// retrieve the message from the JSON response |
|
||||
public function peekaboo() |
|
||||
{ |
|
||||
return $this->json['rows'][0]; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,25 +0,0 @@ |
|||||
<?php namespace Tests\Support\Log\Handlers; |
|
||||
|
|
||||
/** |
|
||||
* Class MockHandler |
|
||||
* |
|
||||
* Extends FileHandler, exposing some inner workings |
|
||||
*/ |
|
||||
|
|
||||
class MockFileHandler extends \CodeIgniter\Log\Handlers\FileHandler |
|
||||
{ |
|
||||
/** |
|
||||
* Where would the log be written? |
|
||||
*/ |
|
||||
public $destination; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function __construct(array $config) |
|
||||
{ |
|
||||
parent::__construct($config); |
|
||||
$this->handles = $config['handles'] ?? []; |
|
||||
$this->destination = $this->path . 'log-' . date('Y-m-d') . '.' . $this->fileExtension; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,64 +0,0 @@ |
|||||
<?php namespace Tests\Support\Log\Handlers; |
|
||||
|
|
||||
/** |
|
||||
* Class TestHandler |
|
||||
* |
|
||||
* A simple LogHandler that stores the logs in memory. |
|
||||
* Only used for testing purposes. |
|
||||
*/ |
|
||||
|
|
||||
class TestHandler extends \CodeIgniter\Log\Handlers\FileHandler |
|
||||
{ |
|
||||
|
|
||||
/** |
|
||||
* Local storage for logs. |
|
||||
* |
|
||||
* @var array |
|
||||
*/ |
|
||||
protected static $logs = []; |
|
||||
|
|
||||
/** |
|
||||
* Where would the log be written? |
|
||||
*/ |
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function __construct(array $config) |
|
||||
{ |
|
||||
parent::__construct($config); |
|
||||
$this->handles = $config['handles'] ?? []; |
|
||||
$this->destination = $this->path . 'log-' . date('Y-m-d') . '.' . $this->fileExtension; |
|
||||
|
|
||||
self::$logs = []; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Handles logging the message. |
|
||||
* If the handler returns false, then execution of handlers |
|
||||
* will stop. Any handlers that have not run, yet, will not |
|
||||
* be run. |
|
||||
* |
|
||||
* @param $level |
|
||||
* @param $message |
|
||||
* |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
public function handle($level, $message): bool |
|
||||
{ |
|
||||
$date = date($this->dateFormat); |
|
||||
|
|
||||
self::$logs[] = strtoupper($level) . ' - ' . $date . ' --> ' . $message; |
|
||||
|
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public static function getLogs() |
|
||||
{ |
|
||||
return self::$logs; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
} |
|
@ -1,82 +0,0 @@ |
|||||
<?php namespace Tests\Support\Log; |
|
||||
|
|
||||
use CodeIgniter\Log\Logger; |
|
||||
|
|
||||
class TestLogger extends Logger |
|
||||
{ |
|
||||
|
|
||||
protected static $op_logs = []; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* The log method is overridden so that we can store log history during |
|
||||
* the tests to allow us to check ->assertLogged() methods. |
|
||||
* |
|
||||
* @param string $level |
|
||||
* @param string $message |
|
||||
* @param array $context |
|
||||
* |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
public function log($level, $message, array $context = []): bool |
|
||||
{ |
|
||||
// While this requires duplicate work, we want to ensure |
|
||||
// we have the final message to test against. |
|
||||
$log_message = $this->interpolate($message, $context); |
|
||||
|
|
||||
// Determine the file and line by finding the first |
|
||||
// backtrace that is not part of our logging system. |
|
||||
$trace = debug_backtrace(); |
|
||||
$file = null; |
|
||||
|
|
||||
foreach ($trace as $row) |
|
||||
{ |
|
||||
if (! in_array($row['function'], ['log', 'log_message'])) |
|
||||
{ |
|
||||
$file = basename($row['file'] ?? ''); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
self::$op_logs[] = [ |
|
||||
'level' => $level, |
|
||||
'message' => $log_message, |
|
||||
'file' => $file, |
|
||||
]; |
|
||||
|
|
||||
// Let the parent do it's thing. |
|
||||
return parent::log($level, $message, $context); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Used by CIUnitTestCase class to provide ->assertLogged() methods. |
|
||||
* |
|
||||
* @param string $level |
|
||||
* @param string $message |
|
||||
* |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
public static function didLog(string $level, $message) |
|
||||
{ |
|
||||
foreach (self::$op_logs as $log) |
|
||||
{ |
|
||||
if (strtolower($log['level']) === strtolower($level) && $message === $log['message']) |
|
||||
{ |
|
||||
return true; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
// Expose cleanFileNames() |
|
||||
public function cleanup($file) |
|
||||
{ |
|
||||
return $this->cleanFileNames($file); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,24 +0,0 @@ |
|||||
<?php namespace Tests\Support\MigrationTestMigrations\Database\Migrations; |
|
||||
|
|
||||
class Migration_another_migration extends \CodeIgniter\Database\Migration |
|
||||
{ |
|
||||
public function up() |
|
||||
{ |
|
||||
$this->forge->addField([ |
|
||||
'key' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 255, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->createTable('foo', true); |
|
||||
|
|
||||
$this->db->table('foo')->insert([ |
|
||||
'key' => 'foobar', |
|
||||
]); |
|
||||
} |
|
||||
|
|
||||
public function down() |
|
||||
{ |
|
||||
$this->forge->dropTable('foo', true); |
|
||||
} |
|
||||
} |
|
@ -1,24 +0,0 @@ |
|||||
<?php namespace Tests\Support\MigrationTestMigrations\Database\Migrations; |
|
||||
|
|
||||
class Migration_some_migration extends \CodeIgniter\Database\Migration |
|
||||
{ |
|
||||
public function up() |
|
||||
{ |
|
||||
$this->forge->addField([ |
|
||||
'key' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 255, |
|
||||
], |
|
||||
]); |
|
||||
$this->forge->createTable('foo', true); |
|
||||
|
|
||||
$this->db->table('foo')->insert([ |
|
||||
'key' => 'foobar', |
|
||||
]); |
|
||||
} |
|
||||
|
|
||||
public function down() |
|
||||
{ |
|
||||
$this->forge->dropTable('foo', true); |
|
||||
} |
|
||||
} |
|
@ -1,28 +0,0 @@ |
|||||
<?php namespace Tests\Support\MigrationTestMigrations\Database\Migrations; |
|
||||
|
|
||||
class Migration_another_migration extends \CodeIgniter\Database\Migration |
|
||||
{ |
|
||||
public function up() |
|
||||
{ |
|
||||
$fields = [ |
|
||||
'value' => [ |
|
||||
'type' => 'VARCHAR', |
|
||||
'constraint' => 255, |
|
||||
], |
|
||||
]; |
|
||||
$this->forge->addColumn('foo', $fields); |
|
||||
|
|
||||
$this->db->table('foo')->insert([ |
|
||||
'key' => 'foobar', |
|
||||
'value' => 'raboof', |
|
||||
]); |
|
||||
} |
|
||||
|
|
||||
public function down() |
|
||||
{ |
|
||||
if ($this->db->tableExists('foo')) |
|
||||
{ |
|
||||
$this->forge->dropColumn('foo', 'value'); |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,11 +0,0 @@ |
|||||
<?php namespace Tests\Support; |
|
||||
|
|
||||
use CodeIgniter\CodeIgniter; |
|
||||
|
|
||||
class MockCodeIgniter extends CodeIgniter |
|
||||
{ |
|
||||
protected function callExit($code) |
|
||||
{ |
|
||||
// Do not call exit() in testing. |
|
||||
} |
|
||||
} |
|
@ -1,37 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
/** |
|
||||
* Common Functions for testing |
|
||||
* |
|
||||
* Several application-wide utility methods. |
|
||||
* |
|
||||
* @package CodeIgniter |
|
||||
* @category Common Functions |
|
||||
*/ |
|
||||
|
|
||||
if (! function_exists('is_cli')) |
|
||||
{ |
|
||||
/** |
|
||||
* Is CLI? |
|
||||
* |
|
||||
* Test to see if a request was made from the command line. |
|
||||
* You can set the return value for testing. |
|
||||
* |
|
||||
* @param boolean $new_return return value to set |
|
||||
* @return boolean |
|
||||
*/ |
|
||||
function is_cli(bool $new_return = null): bool |
|
||||
{ |
|
||||
// PHPUnit always runs via CLI. |
|
||||
static $return_value = true; |
|
||||
|
|
||||
if ($new_return !== null) |
|
||||
{ |
|
||||
$return_value = $new_return; |
|
||||
} |
|
||||
|
|
||||
return $return_value; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
@ -1,22 +0,0 @@ |
|||||
<?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', |
|
||||
]; |
|
||||
} |
|
@ -1,79 +0,0 @@ |
|||||
<?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); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,23 +0,0 @@ |
|||||
<?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 = ''; |
|
||||
} |
|
@ -1,21 +0,0 @@ |
|||||
<?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', |
|
||||
]; |
|
||||
} |
|
@ -1,16 +0,0 @@ |
|||||
<?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 |
|
||||
{ |
|
||||
|
|
||||
} |
|
@ -1,27 +0,0 @@ |
|||||
<?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 = ''; |
|
||||
} |
|
@ -1,30 +0,0 @@ |
|||||
<?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}]', |
|
||||
]; |
|
||||
} |
|
@ -1,34 +0,0 @@ |
|||||
<?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!', |
|
||||
], |
|
||||
]; |
|
||||
} |
|
@ -1,24 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\RESTful; |
|
||||
|
|
||||
use CodeIgniter\RESTful\ResourceController; |
|
||||
|
|
||||
class MockResourceController extends ResourceController |
|
||||
{ |
|
||||
|
|
||||
public function getModel() |
|
||||
{ |
|
||||
return $this->model; |
|
||||
} |
|
||||
|
|
||||
public function getModelName() |
|
||||
{ |
|
||||
return $this->modelName; |
|
||||
} |
|
||||
|
|
||||
public function getFormat() |
|
||||
{ |
|
||||
return $this->format; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,24 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\RESTful; |
|
||||
|
|
||||
use CodeIgniter\RESTful\ResourcePresenter; |
|
||||
|
|
||||
class MockResourcePresenter extends ResourcePresenter |
|
||||
{ |
|
||||
|
|
||||
public function getModel() |
|
||||
{ |
|
||||
return $this->model; |
|
||||
} |
|
||||
|
|
||||
public function getModelName() |
|
||||
{ |
|
||||
return $this->modelName; |
|
||||
} |
|
||||
|
|
||||
public function getFormat() |
|
||||
{ |
|
||||
return $this->format; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,11 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\RESTful; |
|
||||
|
|
||||
use CodeIgniter\RESTful\ResourceController; |
|
||||
|
|
||||
/** |
|
||||
* An extendable controller to provide a RESTful API for a resource. |
|
||||
*/ |
|
||||
class Worker extends ResourceController |
|
||||
{ |
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\RESTful; |
|
||||
|
|
||||
use CodeIgniter\RESTful\ResourcePresenter; |
|
||||
|
|
||||
/** |
|
||||
* An extendable controller to provide a RESTful API for a resource. |
|
||||
*/ |
|
||||
class Worker2 extends ResourcePresenter |
|
||||
{ |
|
||||
|
|
||||
} |
|
@ -1,17 +0,0 @@ |
|||||
<?php namespace Tests\Support\Security; |
|
||||
|
|
||||
use CodeIgniter\Security\Security; |
|
||||
use CodeIgniter\HTTP\RequestInterface; |
|
||||
|
|
||||
class MockSecurity extends Security |
|
||||
{ |
|
||||
public function CSRFSetCookie(RequestInterface $request) |
|
||||
{ |
|
||||
$_COOKIE['csrf_cookie_name'] = $this->CSRFHash; |
|
||||
|
|
||||
return $this; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
@ -1,70 +0,0 @@ |
|||||
<?php namespace CodeIgniter; |
|
||||
|
|
||||
use CIUnitTestCase; |
|
||||
use Config\Services as ConfigServices; |
|
||||
|
|
||||
/** |
|
||||
* Services class for testing. |
|
||||
*/ |
|
||||
class Services |
|
||||
{ |
|
||||
/** |
|
||||
* Mock objects for testing which are returned if exist. |
|
||||
* |
|
||||
* @var array |
|
||||
*/ |
|
||||
static protected $mocks = []; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Reset shared instances and mocks for testing. |
|
||||
*/ |
|
||||
public static function reset() |
|
||||
{ |
|
||||
static::$mocks = []; |
|
||||
|
|
||||
CIUnitTestCase::setPrivateProperty(ConfigServices::class, 'instances', []); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Inject mock object for testing. |
|
||||
* |
|
||||
* @param string $name |
|
||||
* @param $mock |
|
||||
*/ |
|
||||
public static function injectMock(string $name, $mock) |
|
||||
{ |
|
||||
$name = strtolower($name); |
|
||||
static::$mocks[$name] = $mock; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Returns a service |
|
||||
* |
|
||||
* @param string $name |
|
||||
* @param array $arguments |
|
||||
*/ |
|
||||
public static function __callStatic(string $name, array $arguments) |
|
||||
{ |
|
||||
$name = strtolower($name); |
|
||||
|
|
||||
// Returns mock if exists |
|
||||
if (isset(static::$mocks[$name])) |
|
||||
{ |
|
||||
return static::$mocks[$name]; |
|
||||
} |
|
||||
|
|
||||
if (method_exists(ConfigServices::class, $name)) |
|
||||
{ |
|
||||
return ConfigServices::$name(...$arguments); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
@ -1,72 +0,0 @@ |
|||||
<?php namespace Tests\Support\Session; |
|
||||
|
|
||||
use CodeIgniter\Session\Session; |
|
||||
|
|
||||
/** |
|
||||
* Class MockSession |
|
||||
* |
|
||||
* Provides a safe way to test the Session class itself, |
|
||||
* that doesn't interact with the session or cookies at all. |
|
||||
*/ |
|
||||
class MockSession extends Session |
|
||||
{ |
|
||||
/** |
|
||||
* Holds our "cookie" data. |
|
||||
* |
|
||||
* @var array |
|
||||
*/ |
|
||||
public $cookies = []; |
|
||||
|
|
||||
public $didRegenerate = false; |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Sets the driver as the session handler in PHP. |
|
||||
* Extracted for easier testing. |
|
||||
*/ |
|
||||
protected function setSaveHandler() |
|
||||
{ |
|
||||
// session_set_save_handler($this->driver, true); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Starts the session. |
|
||||
* Extracted for testing reasons. |
|
||||
*/ |
|
||||
protected function startSession() |
|
||||
{ |
|
||||
// session_start(); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
/** |
|
||||
* Takes care of setting the cookie on the client side. |
|
||||
* Extracted for testing reasons. |
|
||||
*/ |
|
||||
protected function setCookie() |
|
||||
{ |
|
||||
$this->cookies[] = [ |
|
||||
$this->sessionCookieName, |
|
||||
session_id(), |
|
||||
(empty($this->sessionExpiration) ? 0 : time() + $this->sessionExpiration), |
|
||||
$this->cookiePath, |
|
||||
$this->cookieDomain, |
|
||||
$this->cookieSecure, |
|
||||
true, |
|
||||
]; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function regenerate(bool $destroy = false) |
|
||||
{ |
|
||||
$this->didRegenerate = true; |
|
||||
$_SESSION['__ci_last_regenerate'] = time(); |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
} |
|
@ -1,14 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
namespace Tests\Support; |
|
||||
|
|
||||
use CodeIgniter\Entity; |
|
||||
|
|
||||
class SomeEntity extends Entity |
|
||||
{ |
|
||||
protected $attributes = [ |
|
||||
'foo' => null, |
|
||||
'bar' => null, |
|
||||
]; |
|
||||
|
|
||||
} |
|
@ -1,14 +0,0 @@ |
|||||
<?php namespace Tests\Support\Validation; |
|
||||
|
|
||||
class TestRules { |
|
||||
|
|
||||
public function customError(string $str, string &$error = null) |
|
||||
{ |
|
||||
$error = 'My lovely error'; |
|
||||
|
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
} |
|
Before Width: | Height: | Size: 4.5 KiB |
@ -1,17 +0,0 @@ |
|||||
<?php |
|
||||
namespace Tests\Support\View; |
|
||||
|
|
||||
class MockTable extends \CodeIgniter\View\Table { |
|
||||
|
|
||||
// Override inaccessible protected method |
|
||||
public function __call($method, $params) |
|
||||
{ |
|
||||
if (is_callable([$this, '_' . $method])) |
|
||||
{ |
|
||||
return call_user_func_array([$this, '_' . $method], $params); |
|
||||
} |
|
||||
|
|
||||
throw new BadMethodCallException('Method ' . $method . ' was not found'); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,52 +0,0 @@ |
|||||
<?php namespace Tests\Support\View; |
|
||||
|
|
||||
/** |
|
||||
* Class SampleClass |
|
||||
* |
|
||||
* This class is only used to provide a reference point |
|
||||
* during tests to make sure that things work as expected. |
|
||||
*/ |
|
||||
|
|
||||
class SampleClass { |
|
||||
|
|
||||
public function index() |
|
||||
{ |
|
||||
return 'Hello World'; |
|
||||
} |
|
||||
|
|
||||
public function hello() |
|
||||
{ |
|
||||
return 'Hello'; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function echobox($params) |
|
||||
{ |
|
||||
if (is_array($params)) |
|
||||
{ |
|
||||
$params = implode(',', $params); |
|
||||
} |
|
||||
|
|
||||
return $params; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public static function staticEcho($params) |
|
||||
{ |
|
||||
if (is_array($params)) |
|
||||
{ |
|
||||
$params = implode(',', $params); |
|
||||
} |
|
||||
|
|
||||
return $params; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
public function work($p1, $p2, $p4) |
|
||||
{ |
|
||||
return 'Right on'; |
|
||||
} |
|
||||
} |
|
@ -1 +0,0 @@ |
|||||
<h1><?= $testString ?></h1> |
|
@ -1 +0,0 @@ |
|||||
<h1>{testString}</h1> |
|
@ -1,32 +0,0 @@ |
|||||
<?php |
|
||||
ini_set('error_reporting', E_ALL); |
|
||||
; |
|
||||
ini_set('display_errors', '1'); |
|
||||
ini_set('display_startup_errors', '1'); |
|
||||
|
|
||||
// Make sure it recognizes that we're testing. |
|
||||
$_SERVER['CI_ENVIRONMENT'] = 'testing'; |
|
||||
define('ENVIRONMENT', 'testing'); |
|
||||
|
|
||||
// Load our paths config file |
|
||||
require __DIR__ . '/../../app/Config/Paths.php'; |
|
||||
|
|
||||
// path to the directory that holds the front controller (index.php) |
|
||||
define('FCPATH', realpath(__DIR__ . '/../../') . '/public' . DIRECTORY_SEPARATOR); |
|
||||
|
|
||||
// The path to the "tests" directory |
|
||||
define('TESTPATH', realpath(__DIR__ . '/../') . DIRECTORY_SEPARATOR); |
|
||||
|
|
||||
define('SUPPORTPATH', realpath(TESTPATH . '_support/') . DIRECTORY_SEPARATOR); |
|
||||
|
|
||||
// Set environment values that would otherwise stop the framework from functioning during tests. |
|
||||
if (! isset($_SERVER['app.baseURL'])) |
|
||||
{ |
|
||||
$_SERVER['app.baseURL'] = 'http://example.com'; |
|
||||
} |
|
||||
|
|
||||
//-------------------------------------------------------------------- |
|
||||
// Load our TestCase |
|
||||
//-------------------------------------------------------------------- |
|
||||
|
|
||||
require __DIR__ . '/CIUnitTestCase.php'; |
|
@ -1,70 +0,0 @@ |
|||||
|
|
||||
|
|
||||
Code Coverage Report: |
|
||||
2016-03-31 06:36:22 |
|
||||
|
|
||||
Summary: |
|
||||
Classes: 29.51% (18/61) |
|
||||
Methods: 42.91% (227/529) |
|
||||
Lines: 53.58% (1967/3671) |
|
||||
|
|
||||
\CodeIgniter::CodeIgniter |
|
||||
Methods: 28.57% ( 4/14) Lines: 69.11% ( 85/123) |
|
||||
\CodeIgniter::Controller |
|
||||
Methods: 0.00% ( 0/ 2) Lines: 66.67% ( 6/ 9) |
|
||||
\CodeIgniter\Autoloader::Autoloader |
|
||||
Methods: 42.86% ( 3/ 7) Lines: 89.36% ( 42/ 47) |
|
||||
\CodeIgniter\Autoloader::FileLocator |
|
||||
Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 39/ 39) |
|
||||
\CodeIgniter\CLI::CLI |
|
||||
Methods: 6.25% ( 1/16) Lines: 2.54% ( 3/118) |
|
||||
\CodeIgniter\Config::AutoloadConfig |
|
||||
Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 52/ 52) |
|
||||
\CodeIgniter\Config::BaseConfig |
|
||||
Methods: 50.00% ( 1/ 2) Lines: 83.33% ( 15/ 18) |
|
||||
\CodeIgniter\Config::DotEnv |
|
||||
Methods: 62.50% ( 5/ 8) Lines: 89.29% ( 50/ 56) |
|
||||
\CodeIgniter\Database::BaseBuilder |
|
||||
Methods: 43.33% (39/90) Lines: 62.25% (460/739) |
|
||||
\CodeIgniter\Database::BaseConnection |
|
||||
Methods: 0.00% ( 0/17) Lines: 3.33% ( 2/ 60) |
|
||||
\CodeIgniter\Database::BaseQuery |
|
||||
Methods: 64.71% (11/17) Lines: 74.44% ( 67/ 90) |
|
||||
\CodeIgniter\Debug::Exceptions |
|
||||
Methods: 10.00% ( 1/10) Lines: 2.91% ( 3/103) |
|
||||
\CodeIgniter\Debug::Timer |
|
||||
Methods: 75.00% ( 3/ 4) Lines: 95.24% ( 20/ 21) |
|
||||
\CodeIgniter\HTTP::CLIRequest |
|
||||
Methods: 33.33% ( 2/ 6) Lines: 40.00% ( 14/ 35) |
|
||||
\CodeIgniter\HTTP::CURLRequest |
|
||||
Methods: 62.50% (10/16) Lines: 68.49% (100/146) |
|
||||
\CodeIgniter\HTTP::Header |
|
||||
Methods: 88.89% ( 8/ 9) Lines: 96.88% ( 31/ 32) |
|
||||
\CodeIgniter\HTTP::IncomingRequest |
|
||||
Methods: 60.00% ( 6/10) Lines: 54.05% ( 40/ 74) |
|
||||
\CodeIgniter\HTTP::Message |
|
||||
Methods: 78.57% (11/14) Lines: 86.21% ( 50/ 58) |
|
||||
\CodeIgniter\HTTP::Negotiate |
|
||||
Methods: 75.00% ( 9/12) Lines: 87.65% ( 71/ 81) |
|
||||
\CodeIgniter\HTTP::Request |
|
||||
Methods: 57.14% ( 4/ 7) Lines: 45.79% ( 49/107) |
|
||||
\CodeIgniter\HTTP::Response |
|
||||
Methods: 53.85% ( 7/13) Lines: 79.01% ( 64/ 81) |
|
||||
\CodeIgniter\HTTP::URI |
|
||||
Methods: 81.82% (27/33) Lines: 93.44% (171/183) |
|
||||
\CodeIgniter\HTTP\Files::FileCollection |
|
||||
Methods: 66.67% ( 4/ 6) Lines: 96.49% ( 55/ 57) |
|
||||
\CodeIgniter\HTTP\Files::UploadedFile |
|
||||
Methods: 42.86% ( 6/14) Lines: 39.22% ( 20/ 51) |
|
||||
\CodeIgniter\Hooks::Hooks |
|
||||
Methods: 66.67% ( 4/ 6) Lines: 92.31% ( 36/ 39) |
|
||||
\CodeIgniter\Log::Logger |
|
||||
Methods: 76.92% (10/13) Lines: 92.05% ( 81/ 88) |
|
||||
\CodeIgniter\Router::RouteCollection |
|
||||
Methods: 74.36% (29/39) Lines: 79.64% (133/167) |
|
||||
\CodeIgniter\Router::Router |
|
||||
Methods: 37.50% ( 6/16) Lines: 78.57% ( 77/ 98) |
|
||||
\CodeIgniter\Security::Security |
|
||||
Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 50/ 50) |
|
||||
\CodeIgniter\View::View |
|
||||
Methods: 85.71% ( 6/ 7) Lines: 97.14% ( 34/ 35) |
|