Skip to content

Commit 1077d77

Browse files
authored
Automated testing (#18)
* Create php.yml * updated phpunit command * updated php unit test and file name
1 parent 536c2f9 commit 1077d77

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run PHPUnit Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Validate composer.json and composer.lock
19+
run: composer validate --strict
20+
21+
- name: Cache Composer packages
22+
id: composer-cache
23+
uses: actions/cache@v3
24+
with:
25+
path: vendor
26+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27+
restore-keys: |
28+
${{ runner.os }}-php-
29+
30+
- name: Install dependencies
31+
run: composer install --prefer-dist --no-progress
32+
33+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
34+
# Docs: https://getcomposer.org/doc/articles/scripts.md
35+
36+
# - name: Run test suite
37+
# run: composer run-script test
38+
39+
- name: Run PHPUnit tests
40+
run: vendor/bin/phpunit --coverage-text --colors=never

0 commit comments

Comments
 (0)