parent
5376fa4a39
commit
321bf74487
@ -0,0 +1,11 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* @author Robert Strutts <Bob_586@Yahoo.com> |
||||
* @copyright (c) 2025, Robert Strutts |
||||
* @license MIT |
||||
*/ |
||||
|
||||
echo "Hello, Loaded Test Config file..."; |
||||
@ -1,29 +0,0 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* @author Robert Strutts <Bob_586@Yahoo.com> |
||||
* @copyright (c) 2025, Robert Strutts |
||||
* @license MIT |
||||
*/ |
||||
|
||||
use HydraterBootloader\LicenseVerifier; |
||||
|
||||
define("BaseDir", dirname(__DIR__)); |
||||
|
||||
const PublicPEM = BaseDir."/keydata/public.pem"; |
||||
const AESKeysFile = BaseDir."/src/aeskeys.php"; |
||||
const LicenseFile = BaseDir."/keydata/license.json"; |
||||
|
||||
function tryToEnableFeature(string $featureName) { |
||||
|
||||
if (! class_exists("HydraterBootloader\LicenseVerifier")) { |
||||
return false; |
||||
} |
||||
|
||||
$verifier = new LicenseVerifier(); |
||||
return $verifier->tryEnabledItem(LicenseFile, AESKeysFile, $featureName, PublicPEM); |
||||
} |
||||
|
||||
// tryToEnableFeature("testing"); |
||||
@ -0,0 +1,13 @@ |
||||
<?php |
||||
namespace CodeHydrater; |
||||
|
||||
bootstrap\registry::get('di')->register('db_mocker', function($args) { |
||||
try { |
||||
$conn = new \PDO('sqlite::memory:'); |
||||
// set the PDO error mode to exception |
||||
$conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); |
||||
return $conn; |
||||
} catch (\PDOException $e) { |
||||
\tts\exceptions\DB_Exception::customMessage($e); |
||||
} |
||||
}); |
||||
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
namespace CodeHydrater; |
||||
|
||||
bootstrap\registry::get('di')->register('log', function(array $arg) { |
||||
$file_name = null; |
||||
if (isset($arg[0]) && is_string($arg[0])) { |
||||
$file_name = $arg[0]; // filename |
||||
} |
||||
|
||||
if (isset($arg[1]) && is_int($arg[1])) { |
||||
$count = $arg[1]; // max count |
||||
return new services\log($file_name, $count); |
||||
} |
||||
|
||||
if (! empty($file_name)) { |
||||
return new services\log($file_name); |
||||
} |
||||
|
||||
return new services\log(); |
||||
}); |
||||
Loading…
Reference in new issue