- Dodano testy: SettingsRepositoryTest, LanguagesRepositoryTest, UserRepositoryTest - Infrastruktura: phpunit.xml, composer.json (phpunit/phpunit ^10), tests/bootstrap.php - Bootstrap stuby: \Shared\Cache\CacheHandler (in-memory), \S - Zaktualizowano docs/TESTING.md dla cmsPRO - Paczka: updates/1.60/ver_1.691.zip + manifest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
|
|
// Medoo ORM — potrzebny do mockowania w testach
|
|
require_once __DIR__ . '/../libraries/medoo/medoo.php';
|
|
|
|
// Stub: \Shared\Cache\CacheHandler — musi być załadowany PRZED autoloaderem
|
|
// żeby nie nadpisała go prawdziwa klasa
|
|
namespace Shared\Cache {
|
|
class CacheHandler
|
|
{
|
|
private static array $store = [];
|
|
|
|
public static function reset(): void { self::$store = []; }
|
|
|
|
public static function fetch(string $key): mixed
|
|
{
|
|
return self::$store[$key] ?? false;
|
|
}
|
|
|
|
public static function store(string $key, mixed $value, int $ttl = 0): void
|
|
{
|
|
self::$store[$key] = $value;
|
|
}
|
|
|
|
public static function delete(string $key): void
|
|
{
|
|
unset(self::$store[$key]);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Stub: \S — metody statyczne używane przez repozytoria
|
|
namespace {
|
|
class S
|
|
{
|
|
public static function delete_cache(): void {}
|
|
public static function htacces(): void {}
|
|
public static function get_domain(string $domain = ''): ?string { return $domain ?: null; }
|
|
public static function send_email(string $to, string $subject, string $body): bool { return true; }
|
|
}
|
|
|
|
// PSR-4 autoloader dla Domain\
|
|
// Shared\ jest już obsłużona przez stubę powyżej — pomijamy ją w autoloaderze
|
|
spl_autoload_register(function (string $class): void {
|
|
if (strncmp($class, 'Domain\\', 7) === 0) {
|
|
$rel = substr($class, 7);
|
|
$file = __DIR__ . '/../autoload/Domain/' . str_replace('\\', '/', $rel) . '.php';
|
|
if (file_exists($file)) { require $file; }
|
|
}
|
|
});
|
|
}
|