-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from datamweb/chore-fix
Chore fix
- Loading branch information
Showing
9 changed files
with
168 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of CodeIgniter-DEA-Rule. | ||
* | ||
* (c) 2023 Datamweb <pooya_parsa_dadashi@yahoo.com> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Tests\Support\Config; | ||
|
||
/** | ||
* Class Registrar | ||
* | ||
* Provides a basic registrar class for testing BaseConfig registration functions. | ||
*/ | ||
class Registrar | ||
{ | ||
/** | ||
* DB config array for testing purposes. | ||
* | ||
* @var array | ||
* | ||
* @psalm-suppress RedundantCondition | ||
*/ | ||
protected static $dbConfig = [ | ||
'MySQLi' => [ | ||
'DSN' => '', | ||
'hostname' => '127.0.0.1', | ||
'username' => 'root', | ||
'password' => '', | ||
'database' => 'test', | ||
'DBDriver' => 'MySQLi', | ||
'DBPrefix' => 'db_', | ||
'pConnect' => false, | ||
'DBDebug' => true, | ||
'charset' => 'utf8', | ||
'DBCollat' => 'utf8_general_ci', | ||
'swapPre' => '', | ||
'encrypt' => false, | ||
'compress' => false, | ||
'strictOn' => false, | ||
'failover' => [], | ||
'port' => 3306, | ||
], | ||
'Postgre' => [ | ||
'DSN' => '', | ||
'hostname' => 'localhost', | ||
'username' => 'postgres', | ||
'password' => 'postgres', | ||
'database' => 'test', | ||
'DBDriver' => 'Postgre', | ||
'DBPrefix' => 'db_', | ||
'pConnect' => false, | ||
'DBDebug' => true, | ||
'charset' => 'utf8', | ||
'DBCollat' => 'utf8_general_ci', | ||
'swapPre' => '', | ||
'encrypt' => false, | ||
'compress' => false, | ||
'strictOn' => false, | ||
'failover' => [], | ||
'port' => 5432, | ||
], | ||
'SQLite3' => [ | ||
'DSN' => '', | ||
'hostname' => 'localhost', | ||
'username' => '', | ||
'password' => '', | ||
'database' => 'database.db', | ||
'DBDriver' => 'SQLite3', | ||
'DBPrefix' => 'db_', | ||
'pConnect' => false, | ||
'DBDebug' => true, | ||
'charset' => 'utf8', | ||
'DBCollat' => 'utf8_general_ci', | ||
'swapPre' => '', | ||
'encrypt' => false, | ||
'compress' => false, | ||
'strictOn' => false, | ||
'failover' => [], | ||
'port' => 3306, | ||
'foreignKeys' => true, | ||
], | ||
'SQLSRV' => [ | ||
'DSN' => '', | ||
'hostname' => 'localhost', | ||
'username' => 'sa', | ||
'password' => '1Secure*Password1', | ||
'database' => 'test', | ||
'DBDriver' => 'SQLSRV', | ||
'DBPrefix' => 'db_', | ||
'pConnect' => false, | ||
'DBDebug' => true, | ||
'charset' => 'utf8', | ||
'DBCollat' => 'utf8_general_ci', | ||
'swapPre' => '', | ||
'encrypt' => false, | ||
'compress' => false, | ||
'strictOn' => false, | ||
'failover' => [], | ||
'port' => 1433, | ||
], | ||
'OCI8' => [ | ||
'DSN' => 'localhost:1521/XEPDB1', | ||
'hostname' => '', | ||
'username' => 'ORACLE', | ||
'password' => 'ORACLE', | ||
'database' => '', | ||
'DBDriver' => 'OCI8', | ||
'DBPrefix' => 'db_', | ||
'pConnect' => false, | ||
'DBDebug' => true, | ||
'charset' => 'utf8', | ||
'DBCollat' => 'utf8_general_ci', | ||
'swapPre' => '', | ||
'encrypt' => false, | ||
'compress' => false, | ||
'strictOn' => false, | ||
'failover' => [], | ||
], | ||
]; | ||
|
||
/** | ||
* Override database config | ||
* | ||
* @return array | ||
*/ | ||
public static function Database() | ||
{ | ||
$config = []; | ||
|
||
// Under GitHub Actions, we can set an ENV var named 'DB' | ||
// so that we can test against multiple databases. | ||
if (($group = getenv('DB')) && ! isset(self::$dbConfig[$group])) { | ||
$config['tests'] = self::$dbConfig[$group]; | ||
} | ||
|
||
return $config; | ||
} | ||
} |