Skip to content

[TestApplication] Make the test application run on SQLite - #417

Merged
loic425 merged 2 commits into
Sylius:mainfrom
loic425:feature/test-app-sqlite
Nov 24, 2026
Merged

loic425 merged 2 commits into
Sylius:mainfrom
loic425:feature/test-app-sqlite

Conversation

@loic425

@loic425 loic425 commented Nov 24, 2026

Copy link
Copy Markdown
Member

We may run the demo with PHP WASM, where SQLite is the only realistic database. The test application already almost works on SQLite: schema, fixtures and the whole PHPUnit suite pass. One thing was fragile, and nothing prevents it from regressing.

  • The DAY(), MONTH() and YEAR() DQL functions (dashboard statistics) generated STRFTIME("%d", ...) for SQLite. Double quotes are identifiers in SQL: it only works thanks to SQLite's legacy "double-quoted string" fallback, and fails with no such column: "%d" when SQLite is compiled with SQLITE_DQS=0, which a WASM build may well be. They now use single quotes and cast to INTEGER instead of the non-standard NUMBER.
  • A new sqlite CI job runs the test application suite on SQLite (PHP 8.4 / Symfony ^7.4).
  • PostgreSQL stays the default database, nothing changes there.

To run it locally:

DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" bin/console doctrine:schema:create

(doctrine:database:create is not supported by DBAL 4 on SQLite, the file is created on first connection.)

No BC break: only the test application and CI are touched.

@loic425
loic425 force-pushed the feature/test-app-sqlite branch from 60dad56 to 0155d7b Compare November 24, 2026 15:16
@loic425
loic425 merged commit 25dbd51 into Sylius:main Nov 24, 2026
37 checks passed
@loic425
loic425 deleted the feature/test-app-sqlite branch November 24, 2026 15:18
loic425 added a commit to loic425/SyliusStack that referenced this pull request Nov 25, 2026
The test application runs on SQLite since Sylius#417: with lyrixx/php-wasm-builder,
PHP compiled to WebAssembly runs it in a service worker, so the demo can be
served by GitHub Pages, with no PHP server.

- wasm-demo/castor.php prepares the application (fixtures in a SQLite
  database, no dev dependencies, compiled assets and local icons) and builds
  PHP with it, with ShadcnAdminUi and the rose theme by default.
- wasm-demo/check.mjs logs in and checks every page of the admin panel in
  PHP WebAssembly, in node.
- The Demo workflow builds, checks and deploys it to GitHub Pages.
loic425 added a commit to loic425/SyliusStack that referenced this pull request Nov 25, 2026
The test application runs on SQLite since Sylius#417: with lyrixx/php-wasm-builder,
PHP compiled to WebAssembly runs it in a service worker, so the demo can be
served by GitHub Pages, with no PHP server.

- wasm-demo/castor.php prepares the application (fixtures in a SQLite
  database, no dev dependencies, compiled assets and local icons) and builds
  PHP with it, with ShadcnAdminUi and the rose theme by default.
- wasm-demo/check.mjs logs in and checks every page of the admin panel in
  PHP WebAssembly, in node.
- The Demo workflow builds, checks and deploys it to GitHub Pages.
loic425 added a commit that referenced this pull request Nov 25, 2026
…420)

Trying the Stack today means cloning the monorepo and running a database
and a PHP server. Since #417 the test application runs on SQLite, so PHP
compiled to WebAssembly
([lyrixx/php-wasm-builder](https://github.com/lyrixx/php-wasm-builder))
can run it in a service worker: the demo becomes a static site on GitHub
Pages, with no PHP server.

Live on my fork: https://loic425.github.io/SyliusStack/
(`admin@example.com` / `admin`)

1. **A demo anyone can open**: `wasm-demo/castor.php` builds the
application in prod without dev dependencies, with the fixtures in a
SQLite database and ShadcnAdminUi with the rose theme (`--ui` and
`--theme` change them). Data lives in the browser (IndexedDB) and is
reset at each deploy.
2. **PHP has no network in the browser**: it cannot fetch icons from
Iconify nor serve files, so icons are imported at build time and assets
and avatars are served by Pages, under its base path (`/Stack/`).
3. **A broken page must not be deployed**: `castor demo:check` logs in
and follows every link of the admin panel in PHP WebAssembly under node
(61 pages). The workflow only deploys when it passes.
4. **The home page was empty**: `/` now redirects to the dashboard, for
the dev application too.

The login page also shows the test credentials, as on demo.sylius.com.

```bash
cd wasm-demo && castor demo:build && castor demo:serve
```

**Before merging**: a maintainer needs to set Settings › Pages › Source
to "GitHub Actions". The demo is then deployed on each push to `main` at
https://sylius.github.io/Stack/ (~10 min the first time, ~4 min with the
cache).

**BC**: none, only the `/` route of the test application changes; the
packages are untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant