Add database-backed integration test infrastructure - #423
Merged
Conversation
…naming - Add comment explaining why trash_post uses Ecto.Changeset.change instead of the full changeset (avoids slug validation on nil slugs) - Fix misleading README comment that called delete_language a hard-delete (it archives; clear_translation is the hard-delete) - Add clear_translation usage example to README - Add future refactoring note about rename: clear_translation → hard_delete_translation, delete_language → archive_translation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…on tests Set up embedded test repo (PhoenixKit.Test.Repo) with Ecto sandbox for library-level integration testing without requiring the parent app. Tests gracefully degrade — unit tests still run when PostgreSQL is unavailable. User system tests (152): registration, authentication, sessions, email confirmation, email change, password management, profiles, custom fields, roles (including custom role CRUD), permissions (including grant_all, copy, matrix operations), and Scope integration. Publishing module tests (120): group CRUD and lifecycle, post creation in both timestamp and slug modes, versioning with clone/publish/archive, multi-language translations with status propagation, and end-to-end workflows. Fix two production bugs found by integration tests: - db_storage.ex: FOR UPDATE with aggregate function (PostgreSQL error) - db_storage.ex: DateTime microseconds in insert_all for content cloning Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ddon
added a commit
that referenced
this pull request
Mar 17, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PhoenixKit.Test.Repo) with Ecto sandbox for library-level integration testing — no parent app requireddb_storage.exfound by integration testsmix test.setupbefore testsWhat changed
Test infrastructure:
test/support/test_repo.ex— embedded Ecto repo pointing atphoenix_kit_testDBtest/support/postgres/migrations/— migration wrapper callingPhoenixKit.Migrations.up()config/test.exs— DB config with sandbox pooltest/test_helper.exs— DB detection, graceful degradation, service startuptest/support/data_case.ex— activated sandbox,@moduletag :integrationfor auto-exclusionmix.exs—mix test.setup/mix test.resetaliasesUser system integration tests (152):
Publishing integration tests (120):
Bug fixes:
db_storage.ex:FOR UPDATEcannot be combined with aggregate functions in PostgreSQL — fixed by selecting rows then computing max in Elixirdb_storage.ex:DateTime.utc_now()returns microseconds butinsert_allinto:utc_datetimecolumns rejects them — fixed withDateTime.truncate(:second)Other:
should_regenerate_cache?tests (function was deleted)rate_limiter_test.exsETS table-exists crash when backend already running