Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Test

on:
push:
branches: [master]
pull_request:

jobs:
phpunit:
runs-on: ubuntu-latest

services:
mariadb:
image: mariadb:10.11
env:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: dms-calendar
MARIADB_USER: calendar
MARIADB_PASSWORD: calendar
ports:
- 3306:3306
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=5s
--health-timeout=5s
--health-retries=20

env:
DB_HOST: 127.0.0.1
DB_USERNAME: calendar
DB_PASSWORD: calendar
DB_DATABASE: dms-calendar

steps:
- uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl, pdo_mysql
tools: composer:v2
coverage: none

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php74-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-php74-

- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --no-progress

- name: Configure application
run: ln -s app.default.php config/app.php

- name: Create test database
run: |
mysql -h 127.0.0.1 -uroot -proot -e "CREATE DATABASE \`dms-calendar-test\`;"
mysql -h 127.0.0.1 -uroot -proot -e "GRANT ALL PRIVILEGES ON \`dms-calendar-test\`.* TO 'calendar'@'%';"
mysql -h 127.0.0.1 -uroot -proot -e "FLUSH PRIVILEGES;"

- name: Run PHPUnit
run: vendor/bin/phpunit --no-coverage
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="App Test Suite">
<directory>./tests/TestCase</directory>
<directory suffix="Test.php">./src</directory>
</testsuite>
<!-- Add plugin test suites here. -->
</testsuites>
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/CommitteesControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CommitteesControllerTest extends IntegrationTestCase
*/
public $fixtures = [
'app.committees',
'app.honorarias'
'app.honoraria'
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ContactsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ContactsControllerTest extends IntegrationTestCase
'app.contacts',
'app.w9s',
'app.events',
'app.honorarias'
'app.honoraria'
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/EventsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class EventsControllerTest extends IntegrationTestCase
'app.rooms',
'app.contacts',
'app.prerequisites',
'app.honorarias',
'app.honoraria',
'app.categories',
'app.tools',
'app.files',
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/HonorariaControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HonorariaControllerTest extends IntegrationTestCase
* @var array
*/
public $fixtures = [
'app.honorarias',
'app.honoraria',
'app.events',
'app.committees'
];
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Table/EventsTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class EventsTableTest extends TestCase
'app.rooms',
'app.contacts',
'app.prerequisites',
'app.honorarias',
'app.honoraria',
'app.categories',
'app.tools',
'app.files',
Expand Down
7 changes: 7 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@
require dirname(__DIR__) . '/config/bootstrap.php';

$_SERVER['PHP_SELF'] = '/';

// Register a dedicated 'test' datasource that mirrors the default
// connection but points at a separate database. Fixtures truncate
// tables, so we never want them touching the dev database.
$defaultConfig = \Cake\Datasource\ConnectionManager::getConfig('default');
$defaultConfig['database'] = ($defaultConfig['database'] ?? 'dms-calendar') . '-test';
\Cake\Datasource\ConnectionManager::setConfig('test', $defaultConfig);