-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (68 loc) · 2.33 KB
/
phpunit.yml
File metadata and controls
83 lines (68 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: PHPUnit tests
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: write # Pro commit coverage badge
pages: write # Pro deployment na GitHub Pages
id-token: write # Pro GitHub Pages
services:
postgres:
image: library/postgres:17.5-alpine
env:
POSTGRES_DB: rest_db_test
POSTGRES_USER: app
POSTGRES_PASSWORD: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer
extensions: mbstring, xml, ctype, iconv, intl, pdo_pgsql, xdebug
coverage: xdebug
- name: Fix git ownership issue
run: git config --global --add safe.directory /github/workspace
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-scripts --ignore-platform-req=ext-intl
- name: Create var directory
run: mkdir -p var
- name: Create .env.local
run: |
touch .env.local
echo 'APP_ENV=test' > .env.local
- name: Run database migrations
run: |
php bin/console doctrine:database:create --env=test
php bin/console doctrine:migrations:migrate --no-interaction --env=test
- name: Load test fixtures
run: php bin/console doctrine:fixtures:load --no-interaction --env=test
- name: Verify test data
run: |
echo "Verifying test data..."
php bin/console dbal:run-sql "SELECT COUNT(*) as user_count FROM appuser" --env=test
php bin/console dbal:run-sql "SELECT COUNT(*) as article_count FROM article" --env=test
- name: Run PHPUnit tests
run: php bin/phpunit --testdox