First Local Commit - After Clean up.
Signed-off-by: Rick Hays <rhays@haysgang.com>
This commit is contained in:
18
tests/_support/Config/BadRegistrar.php
Normal file
18
tests/_support/Config/BadRegistrar.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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';
|
||||
}
|
||||
|
||||
}
|
||||
34
tests/_support/Config/MockAppConfig.php
Normal file
34
tests/_support/Config/MockAppConfig.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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',
|
||||
];
|
||||
}
|
||||
21
tests/_support/Config/MockAutoload.php
Normal file
21
tests/_support/Config/MockAutoload.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
}
|
||||
32
tests/_support/Config/MockCLIConfig.php
Normal file
32
tests/_support/Config/MockCLIConfig.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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',
|
||||
];
|
||||
}
|
||||
103
tests/_support/Config/MockLogger.php
Normal file
103
tests/_support/Config/MockLogger.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?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',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
28
tests/_support/Config/MockServices.php
Normal file
28
tests/_support/Config/MockServices.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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());
|
||||
}
|
||||
|
||||
}
|
||||
27
tests/_support/Config/Registrar.php
Normal file
27
tests/_support/Config/Registrar.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
7
tests/_support/Config/Routes.php
Normal file
7
tests/_support/Config/Routes.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This is a simple file to include for testing the RouteCollection class.
|
||||
*/
|
||||
|
||||
$routes->add('testing', 'TestController::index');
|
||||
Reference in New Issue
Block a user