Skip to content

Commit 322f2d9

Browse files
committed
Merge remote-tracking branch 'origin/v2.0.0-alpha.1' into feat/check-in-ux-improvements
# Conflicts: # frontend/src/locales/de.js # frontend/src/locales/de.po # frontend/src/locales/en.js # frontend/src/locales/en.po # frontend/src/locales/es.js # frontend/src/locales/es.po # frontend/src/locales/fr.js # frontend/src/locales/fr.po # frontend/src/locales/hu.js # frontend/src/locales/hu.po # frontend/src/locales/it.js # frontend/src/locales/it.po # frontend/src/locales/nl.js # frontend/src/locales/nl.po # frontend/src/locales/pl.js # frontend/src/locales/pl.po # frontend/src/locales/pt-br.js # frontend/src/locales/pt-br.po # frontend/src/locales/pt.js # frontend/src/locales/pt.po # frontend/src/locales/ru.js # frontend/src/locales/ru.po # frontend/src/locales/se.js # frontend/src/locales/se.po # frontend/src/locales/tr.js # frontend/src/locales/tr.po # frontend/src/locales/vi.js # frontend/src/locales/vi.po # frontend/src/locales/zh-cn.js # frontend/src/locales/zh-cn.po # frontend/src/locales/zh-hk.js # frontend/src/locales/zh-hk.po
2 parents 0446255 + 458a27c commit 322f2d9

50 files changed

Lines changed: 3633 additions & 1452 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/unit-tests.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ on:
55
branches: [main, develop]
66
paths:
77
- 'backend/**'
8+
- '.github/workflows/unit-tests.yml'
89
pull_request:
910
paths:
1011
- 'backend/**'
12+
- '.github/workflows/unit-tests.yml'
1113

1214
jobs:
1315
run-tests:
@@ -17,6 +19,31 @@ jobs:
1719
matrix:
1820
php-versions: ['8.2', '8.3', '8.4']
1921

22+
services:
23+
postgres:
24+
image: postgres:15
25+
env:
26+
POSTGRES_DB: hievents_test
27+
POSTGRES_USER: hievents
28+
POSTGRES_PASSWORD: hievents
29+
ports:
30+
- 5432:5432
31+
options: >-
32+
--health-cmd "pg_isready -U hievents -d hievents_test"
33+
--health-interval 10s
34+
--health-timeout 5s
35+
--health-retries 5
36+
37+
# Job-level env. .env.testing supplies the rest, but the DB host on a CI
38+
# runner is 127.0.0.1 (service container exposes its port on the runner),
39+
# not the docker network alias used locally — override here.
40+
env:
41+
DB_HOST: 127.0.0.1
42+
DB_PORT: 5432
43+
DB_DATABASE: hievents_test
44+
DB_USERNAME: hievents
45+
DB_PASSWORD: hievents
46+
2047
steps:
2148
- name: Checkout code
2249
uses: actions/checkout@v3
@@ -25,7 +52,7 @@ jobs:
2552
uses: shivammathur/setup-php@v2
2653
with:
2754
php-version: ${{ matrix.php-versions }}
28-
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, tokenizer
55+
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, pdo_pgsql, pgsql, tokenizer
2956
ini-values: post_max_size=256M, upload_max_filesize=256M
3057
coverage: none
3158

@@ -47,5 +74,22 @@ jobs:
4774
- name: Install dependencies
4875
run: cd backend && composer install --prefer-dist --no-progress --no-interaction
4976

77+
- name: Stage .env for testing
78+
# Laravel auto-loads .env.testing when APP_ENV=testing, but artisan
79+
# commands run outside that flow read .env directly. Copy .env.testing
80+
# to .env so both paths see the same config.
81+
run: cp backend/.env.testing backend/.env
82+
83+
- name: Wait for Postgres
84+
run: |
85+
for i in {1..30}; do
86+
if pg_isready -h 127.0.0.1 -p 5432 -U hievents -d hievents_test; then
87+
exit 0
88+
fi
89+
sleep 1
90+
done
91+
echo "Postgres did not become ready in time" >&2
92+
exit 1
93+
5094
- name: Run PHPUnit Tests
5195
run: cd backend && ./vendor/bin/phpunit tests/Unit --no-coverage

CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ cd docker/development
9393
- **DON'T** use `RefreshDatabase` - use `DatabaseTransactions` instead
9494
- Unit tests extend Laravel's TestCase, not PHPUnit's TestCase
9595
- Use Mockery for mocking
96+
- Tests run against a dedicated `hievents_test` database, configured via `backend/.env.testing` and enforced by `phpunit.xml`. The local docker-compose creates this database automatically via `docker/development/pgsql-init/`. If your existing pgsql volume predates this script, create the DB once with: `docker compose -f docker-compose.dev.yml exec pgsql psql -U username -d backend -c 'CREATE DATABASE hievents_test OWNER username;'`
97+
- Database name **must end in `_test`**. Enforced globally by a `final` guard in `tests/TestCase.php::guardAgainstNonTestDatabase()` which runs on every test that boots Laravel — no per-test opt-in needed and no way to bypass.
9698

9799
### Frontend
98100

backend/.env.testing

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Auto-loaded by Laravel when APP_ENV=testing (i.e. whenever PHPUnit runs).
2+
# Safe to commit — contains only test-only credentials and fixed test secrets.
3+
# Real secrets must NEVER be added here.
4+
5+
APP_NAME=Hi.Events
6+
APP_ENV=testing
7+
# Static, test-only AES-256 key. Do not reuse outside tests.
8+
APP_KEY=base64:rasMRv+Gm0oDMcBq+j9MvRgR3a6JYPTZjpRD4rGG2wA=
9+
APP_DEBUG=true
10+
APP_URL=http://localhost
11+
APP_FRONTEND_URL=http://localhost
12+
APP_LOG_QUERIES=false
13+
APP_SAAS_MODE_ENABLED=false
14+
15+
LOG_CHANNEL=stderr
16+
LOG_LEVEL=debug
17+
18+
# Database — must end in _test (BaseRepositoryTest enforces this).
19+
# CI exports overrides via the workflow; locally these defaults match the
20+
# docker-compose pgsql service.
21+
DB_CONNECTION=pgsql
22+
DB_HOST=pgsql
23+
DB_PORT=5432
24+
DB_DATABASE=hievents_test
25+
DB_USERNAME=username
26+
DB_PASSWORD=password
27+
28+
# Stateless drivers — keep tests hermetic, no external dependencies.
29+
BROADCAST_DRIVER=log
30+
CACHE_DRIVER=array
31+
FILESYSTEM_PUBLIC_DISK=local
32+
FILESYSTEM_PRIVATE_DISK=local
33+
QUEUE_CONNECTION=sync
34+
SESSION_DRIVER=array
35+
SESSION_LIFETIME=120
36+
MAIL_MAILER=array
37+
38+
# Fixed test JWT secret — do not reuse outside tests.
39+
JWT_SECRET=test-jwt-secret-not-for-production-use-only-in-tests-aaaaaaaaaa
40+
JWT_ALGO=HS256
41+
42+
BCRYPT_ROUNDS=4
43+
TELESCOPE_ENABLED=false

0 commit comments

Comments
 (0)