mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
fix: remove DB_ENV auto-detection; require explicit DB_ENV=test for tests
src/config.php: remove the file-existence fallback that silently redirected
all requests to test.db whenever that file was present on disk. getDatabasePath()
now always returns the production DB unless DB_ENV=test is explicitly set.
tests/run-tests.php: putenv('DB_ENV=test') at the top so the suite always
targets test.db regardless of what is set in the shell environment.
tests/Unit/DatabaseTest.php, tests/Integration/SearchTest.php,
tests/Security/SecurityTest.php: same putenv() guard added to each file so
they work correctly when run standalone (e.g. just test-unit).
justfile: all test and DB-development recipes now prefix DB_ENV=test to their
php/sqlite3 commands, making the intent explicit in the recipe itself.
Fixes: a developer who ran the test suite and kept test.db on disk would
silently hit test data when browsing the local site with no DB_ENV set.
This commit is contained in:
10
justfile
10
justfile
@@ -84,20 +84,20 @@ deploy-db:
|
||||
|
||||
[group('test')]
|
||||
test:
|
||||
@php tests/run-tests.php
|
||||
@DB_ENV=test php tests/run-tests.php
|
||||
|
||||
[group('test')]
|
||||
test-unit:
|
||||
@php tests/Unit/DatabaseTest.php
|
||||
@php tests/Unit/RateLimitTest.php
|
||||
@DB_ENV=test php tests/Unit/DatabaseTest.php
|
||||
@DB_ENV=test php tests/Unit/RateLimitTest.php
|
||||
|
||||
[group('test')]
|
||||
test-integration:
|
||||
@php tests/Integration/SearchTest.php
|
||||
@DB_ENV=test php tests/Integration/SearchTest.php
|
||||
|
||||
[group('test')]
|
||||
test-security:
|
||||
@php tests/Security/SecurityTest.php
|
||||
@DB_ENV=test php tests/Security/SecurityTest.php
|
||||
|
||||
[group('test')]
|
||||
syntax:
|
||||
|
||||
Reference in New Issue
Block a user