Commit Graph
3 Commits
Author SHA1 Message Date
Divarion_D c1dd191d1b test: repair the SQLite test harness broken by strict typing
Two regressions surfaced when running the suite (9 + 3 errors):

- setDb(DatabaseHandler) rejects the SQLite double: the DatabaseAware
  refactor gave setDb() a strict DatabaseHandler hint, but TestDb was a
  standalone class. Make TestDb extend DatabaseHandler (a real subtype) so
  it satisfies the seam; its own constructor wires sqlite::memory: and never
  calls the MySQL-connecting parent constructor. Overridden methods widen
  parameter types (contravariant) and add return types, so LSP holds.

- validateHMAC(int|string $rExpiry) rejects null: HmacTokenTest passed null
  for an intentionally-empty expiry. Pass '' — identical HMAC input, and the
  strict type stays correct (the sole production caller always passes a value).

Suite is green again: 580 tests, 0 errors.
2026-09-13 14:22:55 +03:00
Divarion-D 42db4be509 chore(psr4): phase 3 (Core hubs) — namespace Core/Database
Move Core/Database into XcVm\Core\Database (DatabaseHandler, Database,
MigrationRunner, QueryHelper). First of the Core hub sub-layers.

- Namespace the 4 classes; DatabaseHandler extends Database (same namespace);
  built-ins/ioncube qualified (\PDO, \PDOException, \Exception, \Throwable,
  \XC_VM); Database keeps its 'use XcVm\Core\Logging\FileLogger;'.
- Add 'use XcVm\Core\Database\...;' to referencing files (DatabaseHandler 51,
  Database 64, QueryHelper 29, MigrationRunner 3) + 2 test files (PHPStan does not
  analyse tests/, so PHPUnit is the gate there).
- Rewrite pre-existing leading-backslash global refs (\DatabaseHandler etc., e.g.
  in @param docblocks of ResellerApiDispatcher/ResellerTableRenderer) to the full
  FQCN \XcVm\Core\Database\... — a 'use' import does not cover a leading-\
  reference. Done with a lookbehind so FQCN continuations and use-lines are intact.
- phpstan-baseline.neon regenerated (292→292; pre-existing Database/migration_logic
  findings re-anchored after class names in messages gained the namespace).

Verified: php -l clean; PHPStan no errors; PHPUnit 295/295.
2026-06-24 21:15:06 +03:00
Divarion-D db98c5a18b test(core): add in-memory SQLite DB harness + sample repository test
Adds tests/Support/TestDb.php — a Database-compatible wrapper over
sqlite::memory: injected via setDb() — and StreamConfigRepositoryTest as a
worked example (SELECT/list/keyed/DELETE-cascade/not-found). 286 -> 292 tests.
2026-06-22 19:29:31 +03:00