-
Notifications
You must be signed in to change notification settings - Fork 8
65 lines (57 loc) · 1.99 KB
/
tests.yml
File metadata and controls
65 lines (57 loc) · 1.99 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
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: blogware_test
MYSQL_USER: blogwareuser
MYSQL_PASSWORD: userblogware
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: pdo, pdo_mysql
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Setup test database
run: |
mysql -h 127.0.0.1 -u root -proot -e "CREATE DATABASE IF NOT EXISTS blogware_test;"
php -r '
require "src/install/include/dbtable.php";
$tables = get_table_definitions("");
$pdo = new PDO("mysql:host=127.0.0.1;dbname=blogware_test", "root", "root");
// Only create tables (first 14 items are table definitions)
$tableKeys = [
"tblUser", "tblUserToken", "tblLoginAttempt", "tblPost", "tblMedia",
"tblMediaMeta", "tblMediaDownload", "tblTopic", "tblPostTopic", "tblComment",
"tblMenu", "tblPlugin", "tblSetting", "tblTheme", "tblConsents",
"tblDataRequests", "tblPrivacyLogs", "tblLanguage", "tblTranslation",
"tblDownloadLog", "tblPrivacyPolicy"
];
foreach ($tableKeys as $key) {
if (isset($tables[$key])) {
$pdo->exec($tables[$key]);
}
}
echo "Tables created\n";
'
- name: Run PHPUnit
run: vendor/bin/phpunit tests/unit tests/service tests/integration --testdox --colors=never