Skip to content

Verification

Imam Ali Mustofa edited this page Nov 11, 2026 · 2 revisions

Verification & Proof Harnesses

How we prove what this package claims.

Test suite (Pest)

composer install
./vendor/bin/pest
  • 60 tests, 103 assertions — all green, plus 2 live Turso Cloud tests (11 assertions) which run when cloud credentials are set.
  • The suite re-seeds a pristine database at bootstrap (drops all tables, recreates schema from tests/_files/database/01_create_table.sql, inserts the fixture files in sorted order, then creates artists_backup).
  • Verified repeatedly from a completely empty database (drop-all first).
  • TURSO_HTTP_SKIP_SEED=1 ./vendor/bin/pest skips the seed (e.g. smoke runs).
  • The suite expects libsql-server on 127.0.0.1:8081 by default; override with DB_URL/DB_TOKEN. CI provisions a seeded sqld service container automatically.

Live Turso Cloud tests

tests/Feature/TursoCloudConnectionTest.php runs against a real Turso Cloud database when both variables are set (skipped otherwise, e.g. in CI):

TURSO_CLOUD_DB_URL=libsql://<db>-<org>.turso.io
TURSO_CLOUD_DB_TOKEN=<token>

What they cover:

  • connectivity + SELECT sqlite_version() (3.47.0 observed),
  • typed round trip through the Hrana v3 codec (int / float / text / NULL),
  • transactions (deferred commit visible after commit(), not after rollback()).

Each test creates and drops its own table (turso_http_cloud_proof_<rand>) and always attempts cleanup in finally, so it is safe to run repeatedly against the same cloud database.

CI matrix

.github/workflows/tests.yml on every push to main and on PRs:

PHP Result
8.3 ✅
8.4 ✅
8.5 ✅

composer.lock resolves against PHP 8.3 (config.platform.php = 8.3), so all three legs install the same dependency set. The Turso Cloud tests skip in CI (no credentials there).

Laravel 12 end to end (docker/laravel-proof/)

Fresh Laravel 12 skeleton → this package installed via a path repository → one artisan command asserts five things (service provider discovery, facade resolution, connectivity, facade round trip, transaction commit):

PROOF-LARAVEL: {"ok":5,"fail":0,"all_ok":true, ...}

Green on PHP 8.3 / 8.4 / 8.5:

docker/laravel-proof/proof.sh          # all three
docker/laravel-proof/proof.sh 8.4      # one version

HTTP error behavior

Non-2xx responses (401 / 403 / 404) throw a catchable Darkterminal\TursoHttp\core\LibSQLError carrying the server's error message when present (e.g. HTTP 404: route not found: ["version"] for the sqld-only-/version endpoint on Turso Cloud). They are never silently returned as data.

What is not proven

  • Offline / journaled-write modes against Turso Cloud or sqld — out of scope, not supported (see Known Limitations).
  • DATETIME conversion across every possible stored format — only the exact Y-m-d H:i:s + known timezone path is code-verified.
  • DB_STRICT_QUERY=true explain paths — present in code, not covered by the test suite.

Clone this wiki locally